-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (24 loc) · 763 Bytes
/
Dockerfile
File metadata and controls
35 lines (24 loc) · 763 Bytes
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
FROM node:22-slim AS client-builder
WORKDIR /code/
# Install dependencies
COPY frontend/package.json frontend/package-lock.json /code/
RUN npm ci
# Build the React app
COPY frontend/vite.config.js frontend/eslint.config.js /code/
COPY frontend/index.html .
COPY frontend/public/ public/
COPY frontend/src/ src/
RUN npm run build
FROM python:3.12-slim
WORKDIR /code/
# Install dependencies
COPY backend/requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt fastapi[standard]
# Copy source code
COPY backend/src/ src/
# Use the static assets from the React app
COPY --from=client-builder /code/dist/ public/
# Default value if not provided
ENV PORT=8000
EXPOSE ${PORT}
CMD ["sh", "-c", "fastapi run src/main.py --port ${PORT}"]