-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (27 loc) · 1008 Bytes
/
Dockerfile
File metadata and controls
36 lines (27 loc) · 1008 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
36
FROM node:20-alpine AS spa
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm install --no-audit --no-fund
COPY frontend/ ./
RUN npm run build
FROM python:3.12-slim AS runtime
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev \
&& rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
COPY backend/pyproject.toml backend/uv.lock* ./backend/
RUN cd backend && uv sync --no-dev
COPY backend/ ./backend/
COPY --from=spa /app/frontend/dist ./frontend/dist
ENV SPA_DIST=/app/frontend/dist \
LOG_DIRECTORY=/app/logs/
RUN adduser --disabled-password --gecos '' appuser \
&& mkdir -p /app/logs \
&& chown -R appuser:appuser /app
USER appuser
WORKDIR /app/backend
EXPOSE 8000
# Bind to $PORT when the host injects one (Render, Cloud Run, …); fall back to
# 8000 so local `docker compose up` keeps working.
CMD exec uv run uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-8000}