47 lines
1 KiB
Docker
47 lines
1 KiB
Docker
# Stage 1: Build Vue 3 Frontend
|
|
FROM node:20-alpine AS frontend-builder
|
|
WORKDIR /app/frontend
|
|
|
|
COPY frontend/package*.json ./
|
|
RUN npm ci
|
|
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
# Stage 2: Python / Django Runtime
|
|
FROM python:3.11-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
DJANGO_SETTINGS_MODULE=openforce.settings.prod \
|
|
PORT=8000
|
|
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
libpq-dev \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Python requirements
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application source
|
|
COPY . .
|
|
|
|
# Copy built frontend assets to frontend/dist
|
|
COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist
|
|
|
|
# Collect static files into STATIC_ROOT
|
|
RUN mkdir -p /app/staticfiles /app/data && \
|
|
python manage.py collectstatic --noinput
|
|
|
|
RUN chmod +x /app/entrypoint.sh
|
|
|
|
EXPOSE 8000
|
|
|
|
# Start via entrypoint
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|