|
FROM node:18-alpine AS frontend-builder |
|
|
|
|
|
WORKDIR /app |
|
COPY package*.json ./ |
|
|
|
|
|
RUN npm ci |
|
|
|
|
|
COPY . . |
|
RUN npm run build |
|
|
|
|
|
FROM python:3.11-slim |
|
|
|
|
|
ENV PYTHONPATH=/app/api |
|
ENV PYTHONUNBUFFERED=1 |
|
ENV PORT=8000 |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
curl \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
COPY api/requirements.txt ./api/ |
|
RUN pip install --no-cache-dir -r api/requirements.txt |
|
|
|
|
|
COPY api/ ./api/ |
|
|
|
|
|
COPY --from=frontend-builder /app/dist ./static |
|
|
|
|
|
RUN adduser --disabled-password --gecos '' appuser && \ |
|
chown -R appuser:appuser /app |
|
USER appuser |
|
|
|
|
|
EXPOSE 8000 |
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ |
|
CMD curl -f http://localhost:8000/api/health || exit 1 |
|
|
|
|
|
CMD ["python", "api/main.py"] |