Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (40 loc) · 1.83 KB
/
Copy pathDockerfile
File metadata and controls
44 lines (40 loc) · 1.83 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
# Build for the NAS with: docker buildx build --platform linux/amd64 -t stltosolid .
# ---- frontend ----
FROM node:22-alpine AS webbuild
WORKDIR /build
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci --no-fund --no-audit
COPY frontend/ ./
RUN npm run build
# ---- backend ----
FROM python:3.12-slim
# OpenCascade (via the OCP wheel) and pymeshlab link against OpenGL/X11
# libraries even when used headless; pymeshlab's bundled Qt/plugins also
# need libcom-err2, libp11-kit0 and libgpg-error0 on slim images.
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 libglu1-mesa libxrender1 libxext6 libsm6 libx11-6 fontconfig \
libcom-err2 libp11-kit0 libgpg-error0 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# constraints.txt pins every dependency (see its header for how it was
# resolved); without it each rebuild floats to whatever PyPI serves that
# day, and this stack has proven version-sensitive. Update the pins
# deliberately, then rebuild.
COPY pyproject.toml README.md LICENSE constraints.txt ./
COPY stl_to_solid/ stl_to_solid/
RUN pip install --no-cache-dir --timeout 300 --retries 10 -c constraints.txt '.[scan,blueprint]' fastapi 'uvicorn[standard]' python-multipart
COPY backend/ backend/
COPY --from=webbuild /build/dist frontend/dist
# Build identity, shown top-right in the web UI and at /api/version so a
# tester can tell which commit is running. Set by deploy.sh (or pass
# --build-arg GIT_SHA=... BUILD_TIME=... by hand); defaults say 'unknown'.
ARG GIT_SHA=unknown
ARG BUILD_TIME=unknown
ENV STLTOSOLID_BUILD_SHA=$GIT_SHA
ENV STLTOSOLID_BUILD_TIME=$BUILD_TIME
ENV STLTOSOLID_DATA=/data
# shells converted at once inside a job; docker-compose.yml overrides
ENV STLTOSOLID_WORKERS=2
VOLUME /data
EXPOSE 8000
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]