-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (35 loc) · 1.23 KB
/
Dockerfile
File metadata and controls
45 lines (35 loc) · 1.23 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
36
37
38
39
40
41
42
43
44
45
# ---------- base ----------
FROM python:3.11-slim AS base
ARG APP_DIR=/opt/tigerpath
RUN mkdir -p "$APP_DIR"
WORKDIR "$APP_DIR"
RUN pip install uv
COPY requirements.txt .
RUN uv pip install --system -r requirements.txt
COPY . .
# ---------- development ----------
FROM base AS development
EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
# ---------- frontend (dev server) ----------
FROM oven/bun:1.3.8 AS frontend
WORKDIR /opt/tigerpath/frontend
COPY frontend/package.json frontend/bun.lock ./
RUN bun install --frozen-lockfile --ignore-scripts
COPY frontend .
EXPOSE 3000
CMD ["bun", "run", "dev", "--host", "0.0.0.0"]
# ---------- frontend build assets ----------
FROM oven/bun:1.3.8 AS frontend-build
WORKDIR /opt/tigerpath/frontend
COPY frontend/package.json frontend/bun.lock ./
RUN bun install --frozen-lockfile --ignore-scripts
COPY frontend .
RUN bun run build
# ---------- production ----------
FROM base AS production
# Copy prebuilt frontend assets from dedicated Bun stage
COPY --from=frontend-build /opt/tigerpath/assets/dist /opt/tigerpath/assets/dist
RUN python manage.py collectstatic --noinput
EXPOSE 8000
CMD ["gunicorn", "config.wsgi:application", "-w", "2", "--bind", "0.0.0.0:8000", "--timeout", "600"]