diff --git a/.gitignore b/.gitignore index 0331bf8..600b98f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ memory_files +venv .env .DS_Store secrets/ diff --git a/docker/api/Dockerfile b/docker/api/Dockerfile index fd271c8..da25cdb 100644 --- a/docker/api/Dockerfile +++ b/docker/api/Dockerfile @@ -1,14 +1,5 @@ -# Frontend build stage -FROM node:18-alpine AS frontend-builder - -WORKDIR /frontend -COPY frontend/package*.json ./ -RUN npm install -COPY frontend/ ./ -RUN npm run build - -# Backend build stage -FROM python:3.11-slim +# Backend base stage +FROM python:3.11-slim AS backend-base WORKDIR /app @@ -19,18 +10,30 @@ RUN apt-get update && apt-get install -y \ python3-dev \ && rm -rf /var/lib/apt/lists/* -# Copy requirements files and setup +# Copy and install Python requirements COPY requirements ./requirements/ RUN mkdir src COPY setup.py ./ # Do an initial install to get the dependencies cached RUN pip install -e ".[api]" -# Install the package with common dependencies +# Frontend build stage +FROM node:18-alpine AS frontend-builder + +WORKDIR /frontend +COPY frontend/package*.json ./ +RUN npm install +COPY frontend/ ./ +RUN npm run build + +# Final stage +FROM backend-base + +# Install the package with Python source code COPY src/ ./src/ RUN pip install -e ".[api]" -# Copy frontend build output from previous stage +# Copy frontend build output from frontend stage COPY --from=frontend-builder /frontend/dist ./static/ # Run as non-root user