alternative-backend-service/dockerfile

35 lines
567 B
Plaintext
Raw Normal View History

FROM python:3.11-slim
2025-11-22 19:13:34 +00:00
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
2025-11-22 19:13:34 +00:00
# Set work directory
2025-11-22 19:13:34 +00:00
WORKDIR /app
# Install dependencies
COPY requirements.txt /app/
RUN pip install --upgrade pip && \
pip install -r requirements.txt
2025-11-22 19:13:34 +00:00
# Copy project
COPY . /app/
# Collect static files
RUN python manage.py collectstatic --noinput
2025-11-22 19:13:34 +00:00
# Expose port
EXPOSE 8000
2025-11-22 19:13:34 +00:00
# Run gunicorn
CMD ["gunicorn", "myproject.wsgi:application", "--bind", "0.0.0.0:8000"]
```
**Optional: Create `.dockerignore`:**
```
*.pyc
__pycache__
db.sqlite3
.env
.git
venv/