feat: update production Dockerfile and docker-compose for improved deployment

This commit is contained in:
Sam Chau
2025-02-05 14:40:23 +10:30
parent b335ca73ed
commit c1c129d3c5
3 changed files with 24 additions and 24 deletions

View File

@@ -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"]
# 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()"]

View File

@@ -5,4 +5,5 @@ requests==2.26.0
Werkzeug==2.0.1
GitPython==3.1.24
regex==2023.10.3
APScheduler==3.10.4
APScheduler==3.10.4
gunicorn==21.2.0

View File

@@ -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: