Skip to content

Commit 1261111

Browse files
committed
build: refine dockerfile, remove redundant steps
1 parent 27ef79b commit 1261111

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Dockerfile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ ARG PYTHON_IMG_TAG=3.10
1818

1919

2020
FROM docker.io/python:${PYTHON_IMG_TAG}-slim-bookworm as base
21+
ARG COMMIT_REF
2122
ARG PYTHON_IMG_TAG
22-
ARG PKG_VERSION
2323
2424
LABEL org.hotosm.osm-rawdata.python-img-tag="${PYTHON_IMG_TAG}" \
25-
org.hotosm.osm-rawdata.maintainer="${MAINTAINER}" \
26-
org.hotosm.osm-rawdata.version="${PKG_VERSION}"
25+
org.hotosm.osm-rawdata.commit-ref="${COMMIT_REF}" \
26+
org.hotosm.osm-rawdata.maintainer="${MAINTAINER}"
2727
RUN set -ex \
2828
&& apt-get update \
2929
&& DEBIAN_FRONTEND=noninteractive apt-get install \
@@ -51,7 +51,6 @@ RUN pdm export --prod > requirements.txt \
5151

5252

5353
FROM base as build-wheel
54-
ARG PKG_VERSION
5554
WORKDIR /build
5655
COPY . .
5756
RUN pip install pdm==2.6.1 \
@@ -60,7 +59,6 @@ RUN pip install pdm==2.6.1 \
6059

6160

6261
FROM base as build
63-
ARG PKG_VERSION
6462
WORKDIR /opt/python
6563
RUN set -ex \
6664
&& apt-get update \
@@ -79,9 +77,10 @@ COPY --from=extract-deps \
7977
RUN pip install --user --no-warn-script-location \
8078
--no-cache-dir -r ./requirements.txt
8179
COPY --from=build-wheel \
82-
"/build/dist/osm_rawdata-$PKG_VERSION-py3-none-any.whl" .
83-
RUN pip install --user --no-warn-script-location \
84-
--no-cache-dir "/opt/python/osm_rawdata-$PKG_VERSION-py3-none-any.whl"
80+
"/build/dist/*-py3-none-any.whl" .
81+
RUN whl_file=$(find . -name '*-py3-none-any.whl' -type f) \
82+
&& pip install --user --no-warn-script-location \
83+
--no-cache-dir "${whl_file}"
8584

8685

8786

0 commit comments

Comments
 (0)