From 6da85cdece292f96c78e12a6c4fa274344ec3dcc Mon Sep 17 00:00:00 2001 From: marwin Date: Sun, 20 Apr 2025 19:25:08 +0100 Subject: [PATCH] Refactor Docker setup: update docker-compose.yml to use a specific website directory for volumes, enable automatic restarts, and modify Dockerfile to clean up and copy application files more efficiently. --- Dockerfile | 6 +++++- docker-compose.yml | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index a786bd4..33b4c35 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,14 @@ FROM python:3.11-slim WORKDIR /app +# Clean up and install requirements +RUN rm -rf /app/* COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt -COPY . . +# Copy application files +COPY website/ ./website/ +COPY requirements.txt . EXPOSE 5000 diff --git a/docker-compose.yml b/docker-compose.yml index 7fa6c8a..134152e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,11 +5,13 @@ services: build: context: . dockerfile: Dockerfile + force: true ports: - "5000:5000" volumes: - - .:/app + - ./website:/app/website environment: - FLASK_ENV=development - FLASK_DEBUG=1 - command: python website/app.py \ No newline at end of file + command: python website/app.py + restart: always \ No newline at end of file