Skip to content

Commit

Permalink
Merge pull request #18 from a5chin/feature/docker
Browse files Browse the repository at this point in the history
Rewrite to Dockerfile for deployment
  • Loading branch information
a5chin authored Jun 7, 2024
2 parents e9e8e88 + cb973cd commit 4380c3d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
34 changes: 12 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
FROM debian:bookworm-slim as builder
ARG VARIANT=3.12
FROM python:${VARIANT} as builder

WORKDIR /opt

ENV RYE_HOME="/opt/rye"
ENV PATH="$RYE_HOME/shims:$PATH"

# hadolint ignore=DL3008
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl
ENV PYTHONDONTWRITEBYTECODE True

SHELL [ "/bin/bash", "-o", "pipefail", "-c" ]
RUN curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash && \
rye config --set-bool behavior.global-python=true && \
rye config --set-bool behavior.use-uv=true
WORKDIR /opt
COPY pyproject.toml requirements.lock ./

COPY ./.python-version ./pyproject.toml ./requirements* ./
RUN rye pin "$(cat .python-version)" && \
rye sync --no-dev
# hadolint ignore=DL3013,DL3042
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.lock


FROM debian:bookworm-slim
COPY --from=builder /opt/rye /opt/rye
FROM python:${VARIANT}-slim
COPY --from=builder /usr/local/lib/python*/site-packages /usr/local/lib/python*/site-packages

ENV RYE_HOME="/opt/rye"
ENV PATH="$RYE_HOME/shims:$PATH"
ENV PYTHONUNBUFFERED True

WORKDIR /
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ managed = true
dev-dependencies = [
"pytest>=8.2.1",
"pre-commit>=3.7.0",
"ruff>=0.4.4",
"ruff>=0.4.7",
]

0 comments on commit 4380c3d

Please sign in to comment.