Skip to content

Commit c998394

Browse files
build: use uv for venv and deps
Keep poetry-centric pyproject.toml for meow
1 parent 0611d49 commit c998394

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
**/obj
4444
**/pre-commit-config.yaml
4545
**/Procfile
46-
**/README.md
4746
**/redis-data
4847
**/redis-insight
4948
**/redis.conf*

Dockerfile.web

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# full semver just for python base image
44
ARG PYTHON_VERSION=3.11.11
55

6-
FROM python:${PYTHON_VERSION}-slim AS builder
6+
FROM python:${PYTHON_VERSION}-slim-bookworm as builder
77

88
# avoid stuck build due to user prompt
99
ARG DEBIAN_FRONTEND=noninteractive
@@ -22,33 +22,33 @@ ENV PIP_NO_CACHE_DIR=off
2222
ENV PIP_DISABLE_PIP_VERSION_CHECK=on
2323
ENV PIP_DEFAULT_TIMEOUT=100
2424

25-
# path
26-
ENV VENV="/opt/venv"
25+
# venv
26+
ARG UV_PROJECT_ENVIRONMENT="/opt/venv"
27+
ENV VENV="${UV_PROJECT_ENVIRONMENT}"
2728
ENV PATH="$VENV/bin:$PATH"
2829

30+
# uv
31+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
32+
2933
WORKDIR /app
30-
COPY ./app .
31-
COPY ./requirements.txt .
3234

33-
RUN python -m venv $VENV \
34-
&& python -m pip install -r requirements.txt
35+
COPY ./app .
36+
COPY ./README.md .
37+
COPY pyproject.toml .
3538

36-
# ! heroku doesn't use buildkit
37-
# RUN --mount=type=cache,target=/root/.cache/pip \
38-
# --mount=type=bind,source=./requirements.txt,target=/app/requirements.txt \
39-
# python -m pip install -r requirements.txt
39+
RUN uv venv $UV_PROJECT_ENVIRONMENT \
40+
&& uv pip install -r pyproject.toml
4041

41-
FROM python:${PYTHON_VERSION}-slim AS runner
42+
FROM python:${PYTHON_VERSION}-slim-bookworm as runner
4243

4344
# set timezone
4445
ENV TZ=${TZ:-"America/Chicago"}
4546
RUN ln -snf "/usr/share/zoneinfo/${TZ}" /etc/localtime && echo "$TZ" > /etc/timezone
4647

4748
# setup standard non-root user for use downstream
4849
ENV USER_NAME=appuser
49-
ENV VENV="/opt/venv"
50-
51-
ENV PATH="${VENV}/bin:${VENV}/lib/python${PYTHON_VERSION}/site-packages:/usr/local/bin:${HOME}/.local/bin:/bin:/usr/bin:/usr/share/doc:$PATH"
50+
ARG VENV="/opt/venv"
51+
ENV PATH=$VENV/bin:$HOME/.local/bin:$PATH
5252

5353
# standardise on locale, don't generate .pyc, enable tracebacks on seg faults
5454
ENV LANG C.UTF-8

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ description = "Use Meetup Pro API to send Slack messages before events occur."
55
authors = ["pythoninthegrass <[email protected]>"]
66
readme = "README.md"
77
license = "Unlicense"
8-
package-mode = false
98

109
[tool.poetry.dependencies]
1110
python = ">=3.11,<3.13"

0 commit comments

Comments
 (0)