From 02e048c109f3600ae09278bb85fbee1be75abb7d Mon Sep 17 00:00:00 2001 From: Marc Lopez Date: Fri, 7 Jun 2024 03:23:21 +0200 Subject: [PATCH] Improve Dockerfile Add .venv to gitignore & dockerignore --- .dockerignore | 1 + .gitignore | 4 +++- Dockerfile | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..b694934f --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.venv \ No newline at end of file diff --git a/.gitignore b/.gitignore index d54bd3cb..d21938e8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ __pycache__ pipelines/* !pipelines/.gitignore -.DS_Store \ No newline at end of file +.DS_Store + +.venv \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ba36e641..b6d8c7ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,11 +18,11 @@ RUN apt-get update && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* -# Copy the application code -COPY . /app + WORKDIR /app # Install Python dependencies +COPY ./requirements.txt . RUN pip3 install uv && \ if [ "$USE_CUDA" = "true" ]; then \ pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/$USE_CUDA_DOCKER_VER --no-cache-dir && \ @@ -32,6 +32,8 @@ RUN pip3 install uv && \ uv pip install --system -r requirements.txt --no-cache-dir; \ fi +# Copy the application code +COPY . . # Expose the port ENV HOST="0.0.0.0"