Files
school-meal/backend/Dockerfile
T

21 lines
642 B
Docker

FROM python:3.12-slim
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["sh", "-c", "\
python manage.py migrate --noinput && \
python manage.py seed_dishes && \
python manage.py collectstatic --noinput && \
python manage.py shell -c \"from django.contrib.auth import get_user_model; U=get_user_model(); U.objects.filter(username='admin').exists() or U.objects.create_superuser('admin','admin@example.com','admin123')\" && \
gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 3 --timeout 60"]