-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (26 loc) · 926 Bytes
/
Dockerfile
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
FROM python:3.10-slim as base
LABEL org.opencontainers.image.source="https://github.com/ZiRO-Bot/nexus"
LABEL org.opencontainers.image.description="FastAPI-based backend"
LABEL org.opencontainers.image.licenses=MPL-2.0
# ---
FROM base as builder
WORKDIR /app
ENV PATH="/root/.local/bin:${PATH}" \
VIRTUAL_ENV="/venv"
RUN apt-get update && apt-get install -y patch
RUN pip install -U pip setuptools wheel
RUN pip install pdm
RUN python -m venv /venv
COPY pyproject.toml pdm.lock uvicorn.patch ./
ADD nexus/ ./nexus
RUN pdm sync --prod --no-editable
RUN patch /venv/lib/python3.10/site-packages/uvicorn/main.py < /app/uvicorn.patch
# ---
FROM base as final
WORKDIR /app
ENV PATH="/venv/bin:${PATH}" \
VIRTUAL_ENV="/venv"
COPY --from=builder /venv /venv
COPY --from=builder /app/nexus/ /app/nexus
COPY assets/ /app/assets
CMD ["uvicorn", "nexus.app:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "80"]