-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from a5chin/feature/docker
Rewrite to Dockerfile for deployment
- Loading branch information
Showing
2 changed files
with
13 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
] |