generated from linz/template-python-hello-world
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
45 lines (30 loc) · 1.15 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.9.0@sha256:d1a38af532e5d9e3991c4a6bddc2f2cb52644dc30a4eb8242101e8e23c3f83f6 AS builder
# Avoid blocking `apt-get install` commands
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
RUN apt-get update
# Install pipx and build dependencies
RUN apt-get install --assume-yes gcc libgeos-dev pipx python3-dev
# Install Poetry with the bundle plugin
RUN pipx install poetry
RUN pipx inject poetry poetry-plugin-bundle
# Define the working directory for the following commands
WORKDIR /src
# Add Poetry config
COPY poetry.lock pyproject.toml /src/
# Bundle production dependencies into /venv
RUN /root/.local/bin/poetry bundle venv --no-ansi --no-interaction --only=main -vvv /venv
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.9.0@sha256:d1a38af532e5d9e3991c4a6bddc2f2cb52644dc30a4eb8242101e8e23c3f83f6
ARG GIT_HASH
ENV GIT_HASH=$GIT_HASH
ARG GIT_VERSION
ENV GIT_VERSION=$GIT_VERSION
ENV TZ=Etc/UTC
# Copy just the bundle from the first stage
COPY --from=builder /venv /venv
# Copy Python scripts
COPY ./scripts/ /app/scripts/
ENV PYTHONPATH="/app"
ENV GTIFF_SRS_SOURCE="EPSG"
WORKDIR /app/scripts
ENTRYPOINT ["./docker-entrypoint.sh"]