From 570f5d8fc8d66865ad694f247850491597c5d9a5 Mon Sep 17 00:00:00 2001 From: saani Date: Sun, 23 Nov 2025 23:34:59 +0000 Subject: [PATCH] refactor(docker): streamline Dockerfile and add gunicorn workers - Remove redundant comments for cleaner readability - Simplify COPY commands using relative paths - Condense pip installation RUN command to single line - Add 3 workers to gunicorn for improved concurrent request handling - Remove accidentally included .dockerignore content from Dockerfile This improves Dockerfile maintainability and production performance by configuring multiple gunicorn workers for better throughput. --- dockerfile | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/dockerfile b/dockerfile index 658b108..4450e9b 100644 --- a/dockerfile +++ b/dockerfile @@ -1,35 +1,17 @@ FROM python:3.11-slim -# Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 -# Set work directory WORKDIR /app -# Install dependencies -COPY requirements.txt /app/ -RUN pip install --upgrade pip && \ - pip install -r requirements.txt +COPY requirements.txt . +RUN pip install --upgrade pip && pip install -r requirements.txt -# Copy project -COPY . /app/ +COPY . . -# Collect static files RUN python manage.py collectstatic --noinput -# Expose port EXPOSE 8000 -# Run gunicorn -CMD ["gunicorn", "booking_system.wsgi:application", "--bind", "0.0.0.0:8000"] -``` - -**Optional: Create `.dockerignore`:** -``` -*.pyc -__pycache__ -db.sqlite3 -.env -.git -venv/ \ No newline at end of file +CMD ["gunicorn", "booking_system.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "3"] \ No newline at end of file -- 2.39.5