-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.fullstack
More file actions
35 lines (29 loc) · 1 KB
/
Copy pathDockerfile.fullstack
File metadata and controls
35 lines (29 loc) · 1 KB
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
# Single Dockerfile: build frontend, then run backend serving it (cheapest single-component deploy).
# Use this on DigitalOcean by pointing the app at this Dockerfile so you only pay for one app.
# ---- Frontend build ----
FROM node:18-alpine AS frontend
WORKDIR /app/frontend
COPY frontend/package.json ./
RUN npm install
COPY frontend/ .
# Same-origin API when served from backend (no separate frontend URL)
ENV VITE_API_URL=
RUN npm run build
# ---- Backend + serve frontend ----
FROM python:3.11-slim
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
COPY src/ ./src/
COPY test/ ./test/
COPY alembic.ini .
COPY alembic/ ./alembic/
# Copy built frontend into static/ so FastAPI can serve it
RUN mkdir -p /app/static
COPY --from=frontend /app/frontend/dist/. /app/static/
EXPOSE 8080
CMD ["uvicorn", "src.api.main:app", "--host", "0.0.0.0", "--port", "8080"]