Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (36 loc) · 1.42 KB
/
Copy pathDockerfile
File metadata and controls
50 lines (36 loc) · 1.42 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
46
47
48
49
50
# ------------------------------------------------------------
# Frontend build stage
# ------------------------------------------------------------
FROM node:26-bookworm-slim AS frontend-builder
WORKDIR /
# git is only needed to fetch tileviewer
RUN apt-get update && apt-get install -y --no-install-recommends \
git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Clone and build tileviewer
RUN git clone https://github.com/simonsobs/tileviewer.git
WORKDIR /tileviewer
# Clean any potentially stale Vite artifacts, then install and build
RUN npm cache clean --force \
&& rm -rf node_modules/.vite \
&& npm install \
&& npm run build
# ------------------------------------------------------------
# Python runtime stage
# ------------------------------------------------------------
FROM python:3.13-bookworm
WORKDIR /livetiler
# Copy this repo's Python code
COPY ./tilemaker ./tilemaker
COPY ./pyproject.toml ./pyproject.toml
# Copy the compiled frontend from the Node build stage
RUN rm -rf tilemaker/server/static \
&& mkdir -p tilemaker/server/static
COPY --from=frontend-builder \
/tileviewer/dist/ \
./tilemaker/server/static/
# Install Python application and runtime server
RUN pip install --no-cache-dir --upgrade . \
&& pip install --no-cache-dir --upgrade gunicorn
EXPOSE 8000
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "-w", "8", "tilemaker.server:app", "--bind", "0.0.0.0:8000"]