Skip to content

Commit

Permalink
fix: Hopefully work
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Jul 12, 2023
1 parent 44414dd commit e2b5202
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
# build stage
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 pip install -U pip setuptools wheel
RUN pip install pdm

COPY pyproject.toml pdm.lock README.md /project/
COPY nexus/ /project/nexus

WORKDIR /project
RUN mkdir __pypackages__ && pdm sync --prod --no-editable
COPY pyproject.toml pdm.lock ./
COPY nexus/ ./
RUN pdm sync --prod --no-editable

# ---
FROM base as final

WORKDIR /project
COPY --from=builder /project/nexus ./nexus
WORKDIR /app

ENV PATH="/venv/bin:${PATH}" \
VIRTUAL_ENV="/venv"

COPY --from=builder /venv /venv
COPY --from=builder /app/nexus/ /app/nexus

CMD ["uvicorn", "nexus.app:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "80"]

0 comments on commit e2b5202

Please sign in to comment.