38 lines
1.0 KiB
Docker
38 lines
1.0 KiB
Docker
# Build the Vue app from source rather than relying on a host-generated directory.
|
|
FROM node:20-alpine AS frontend-builder
|
|
|
|
WORKDIR /frontend
|
|
COPY frontend/package*.json ./
|
|
RUN npm ci
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
FROM python:3.12-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
|
DJANGO_SETTINGS_MODULE=config.settings.prod
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libpq-dev gcc curl && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Keep the runtime dependency set in one lock file used by local and Docker installs.
|
|
COPY backend/requirements.txt /tmp/requirements.txt
|
|
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
|
|
|
COPY backend/ /app/
|
|
COPY --from=frontend-builder /frontend/dist/ /app/frontend_dist/
|
|
|
|
RUN mkdir -p /app/staticfiles /app/media
|
|
|
|
EXPOSE 8000
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
CMD curl -fsS http://127.0.0.1:8000/api/v1/ping/ || exit 1
|
|
|
|
CMD ["sh", "infra/scripts/run_prod_granian.sh"]
|