Skip to content

Commit 364d2da

Browse files
joker234matthiasschaub
authored andcommitted
first idea for Dockerfile (based on main)
1 parent bbeb26a commit 364d2da

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

Dockerfile

+15-14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ RUN npm run build
1313

1414
# build python app
1515
FROM python:3.12-bookworm AS python-builder
16+
COPY --from=ghcr.io/astral-sh/uv:0.6.2 /uv /uvx /bin/
1617

1718
WORKDIR /app
1819

@@ -28,26 +29,26 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
2829
libzbar0 \
2930
python3-gdal
3031

31-
ENV POETRY_NO_INTERACTION=1 \
32-
POETRY_VIRTUALENVS_IN_PROJECT=1 \
33-
POETRY_VIRTUALENVS_CREATE=1 \
34-
POETRY_CACHE_DIR=/tmp/poetry_cache \
35-
POETRY_REQUESTS_TIMEOUT=600
32+
ENV UV_LINK_MODE=copy \
33+
UV_HTTP_TIMEOUT=300s
3634

37-
COPY pyproject.toml poetry.lock ./
38-
39-
RUN --mount=type=cache,target=$POETRY_CACHE_DIR python3 -m pip install --break-system-packages poetry setuptools \
40-
&& python3 -m poetry install --only main --no-root --no-directory
35+
RUN --mount=type=cache,target=/root/.cache/uv \
36+
--mount=type=bind,source=uv.lock,target=uv.lock \
37+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
38+
uv sync --frozen --no-install-project \
39+
&& uv pip install \
40+
gdal[numpy]=="$(gdal-config --version).*" \
41+
psycopg2
4142

4243
COPY sketch_map_tool sketch_map_tool
4344
COPY data data
4445
COPY config config
4546

46-
RUN --mount=type=cache,target=$POETRY_CACHE_DIR python3 -m poetry install --only main --no-root --no-directory \
47-
&& python3 -m poetry run python -m pip install \
48-
gdal[numpy]=="$(gdal-config --version).*" \
49-
psycopg2 \
50-
&& python3 -m poetry run pybabel compile -d sketch_map_tool/translations
47+
RUN --mount=type=cache,target=/root/.cache/uv \
48+
--mount=type=bind,source=uv.lock,target=uv.lock \
49+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
50+
uv sync --frozen --no-editable \
51+
&& uv run pybabel compile -d sketch_map_tool/translations
5152

5253

5354
# final image

0 commit comments

Comments
 (0)