From c1c129d3c5c3e318fc0d8c970f997083b4b1dc6d Mon Sep 17 00:00:00 2001 From: Sam Chau Date: Wed, 5 Feb 2025 14:40:23 +1030 Subject: [PATCH] feat: update production Dockerfile and docker-compose for improved deployment --- backend/Dockerfile.prod | 29 +++++++++++++++-------------- backend/requirements.txt | 3 ++- docker-compose.prod.yml | 16 +++++++--------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/backend/Dockerfile.prod b/backend/Dockerfile.prod index 8082e7e..793e8a1 100644 --- a/backend/Dockerfile.prod +++ b/backend/Dockerfile.prod @@ -1,17 +1,18 @@ -# backend/Dockerfile.prod -# Build frontend -FROM node:18 AS frontend-builder -WORKDIR /frontend -COPY frontend/package*.json ./ -RUN npm install -COPY frontend/ ./ -RUN npm run build - -# Backend +# Dockerfile FROM python:3.9 WORKDIR /app -COPY backend/requirements.txt . + +COPY dist/backend/* . +COPY dist/static ./app/static +COPY dist/requirements.txt . + RUN pip install --no-cache-dir -r requirements.txt -COPY backend/ . -COPY --from=frontend-builder /frontend/dist ./app/static -CMD ["python", "-m", "app.main"] \ No newline at end of file + +# Add labels for Docker Hub +LABEL org.opencontainers.image.authors="Dictionarry dictionarry@pm.me" +LABEL org.opencontainers.image.description="Profilarr - Profile manager for *arr apps" +LABEL org.opencontainers.image.source="https://github.com/Dictionarry-Hub/profilarr" +LABEL org.opencontainers.image.title="Profilarr" +LABEL org.opencontainers.image.version="beta" + +CMD ["gunicorn", "--bind", "0.0.0.0:6868", "app.main:create_app()"] \ No newline at end of file diff --git a/backend/requirements.txt b/backend/requirements.txt index 289d648..377dba4 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -5,4 +5,5 @@ requests==2.26.0 Werkzeug==2.0.1 GitPython==3.1.24 regex==2023.10.3 -APScheduler==3.10.4 \ No newline at end of file +APScheduler==3.10.4 +gunicorn==21.2.0 \ No newline at end of file diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 1e5339f..cce5de9 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,20 +1,18 @@ -# docker-compose.prod.yml +# docker-compose.yml version: '3.8' services: - backend: - build: - context: . - dockerfile: backend/Dockerfile.prod + profilarr: + image: yourusername/profilarr:latest # For Docker Hub + container_name: profilarr ports: - - '5000:5000' + - 6868:6868 volumes: - profilarr_data:/config environment: - - FLASK_ENV=production - TZ=Australia/Adelaide env_file: - - .env.prod - restart: always + - .env + restart: unless-stopped volumes: profilarr_data: