-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
29 lines (21 loc) · 1015 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Use official Python image
FROM python:3.12
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1 # Prevents .pyc files
ENV PYTHONUNBUFFERED 1 # Ensures logs are visible
# Set working directory
WORKDIR /code
# Install system dependencies (vim, nano) and clean up cache
RUN apt-get update && apt-get install -y vim nano && rm -rf /var/lib/apt/lists/*
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
COPY development.txt .
# Install dependencies based on the environment
ARG ENV_NAME
RUN if [ "$ENV_NAME" = "development" ]; then pip install -r development.txt; else pip install -r requirements.txt; fi
# Copy the rest of the application files
COPY . .
# Expose the port for the application
EXPOSE 80
# Default command: Run migrations, collect static, seed data, and start Gunicorn server
CMD sh -c 'python manage.py migrate && python manage.py collectstatic --noinput && python manage.py seeds && gunicorn product_selection_backend.wsgi:application --bind 0.0.0.0:80'