-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (27 loc) · 1.49 KB
/
Copy pathDockerfile
File metadata and controls
30 lines (27 loc) · 1.49 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
# syntax=docker/dockerfile:1
# Single-container TaxAssist: builds the React frontend, then serves it from FastAPI
# alongside the API. One image, one Cloud Run / Render service.
# ── 1. Build the React frontend ──────────────────────────────────────────────
FROM node:20-slim AS frontend
WORKDIR /frontend
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ ./
# Same-origin API in production (BASE defaults to "" → calls go to "/me" on this server).
RUN npm run build
# ── 2. Install Python deps ───────────────────────────────────────────────────
FROM python:3.12-slim AS builder
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
# ── 3. Runtime ───────────────────────────────────────────────────────────────
FROM python:3.12-slim
WORKDIR /app
ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
COPY --from=builder /install /usr/local
COPY app ./app
# Bundle the built SPA so FastAPI can serve it at "/".
COPY --from=frontend /frontend/dist ./app/static
EXPOSE 8080
# Honors Cloud Run's injected $PORT (defaults to 8080).
CMD uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-8080} --proxy-headers --forwarded-allow-ips=*