-
Notifications
You must be signed in to change notification settings - Fork 132
/
Copy pathDockerfile.backend
37 lines (33 loc) · 1.05 KB
/
Dockerfile.backend
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM python:3.12-slim AS base
RUN apt-get update && apt-get install -y \
libpq-dev \
gcc \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN pip install uv
WORKDIR /pyspur/backend
COPY backend/pyproject.toml .
RUN uv pip compile pyproject.toml > requirements.txt && \
uv pip install --system --no-cache-dir -r requirements.txt && \
rm requirements.txt
# Development stage
FROM base AS development
ENV PYTHONPATH=/pyspur/backend
# Development-specific instructions here
# Frontend build stage
FROM node:23-alpine AS frontend-builder
WORKDIR /pyspur/frontend
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ .
RUN npm run build
# Production stage
FROM base AS production
ENV PYTHONPATH=/pyspur/backend
COPY backend/ .
# Copy frontend static files from frontend build stage
RUN mkdir -p /pyspur/backend/pyspur/static
RUN rm -rf /pyspur/backend/pyspur/static/*
COPY --from=frontend-builder /pyspur/frontend/out/ /pyspur/backend/pyspur/static/
COPY .env.example /pyspur/backend/pyspur/templates/.env.example
# Production-specific instructions here