38 lines
978 B
Docker
38 lines
978 B
Docker
FROM python:3.13.5-slim-bookworm
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
libpq-dev \
|
|
curl \
|
|
netcat-openbsd \
|
|
gcc \
|
|
libffi-dev \
|
|
libssl-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements.txt /app/
|
|
RUN pip install --upgrade pip \
|
|
&& pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY . .
|
|
WORKDIR /app
|
|
|
|
# Optionally run migrations and collectstatic on container start
|
|
# (better done via entrypoint script for robustness)
|
|
# CMD ["sh", "-c", "python manage.py migrate && python manage.py collectstatic --noinput"]
|
|
|
|
# Use entrypoint for wait-for-db or init tasks
|
|
COPY ./entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
# Command to run the server
|
|
CMD ["gunicorn", "freekake_api.wsgi:application", "--bind", "0.0.0.0:8000"]
|