Files
ukmesh/viewshed-worker/Dockerfile

47 lines
2.0 KiB
Docker

FROM ghcr.io/osgeo/gdal:ubuntu-full-3.13.3@sha256:2dd0f81ef927ff4c3d4dbe4f73c029dc86d4073974c0564f8e196f6e1412e2e0
WORKDIR /app
# The hosted amd64 CI workers can use Ubuntu's Azure mirror for the same signed suites.
ARG USE_AZURE_UBUNTU_MIRROR=false
# A hosted Azure replica can lack an update/security index during sync. APT
# tries the original signed Ubuntu suite if a file is missing on that replica.
RUN if [ "$USE_AZURE_UBUNTU_MIRROR" = true ]; then \
set -e; \
for archive in archive security; do \
mirrors="/etc/apt/ubuntu-$archive.mirrors"; \
printf 'https://azure.archive.ubuntu.com/ubuntu/\tpriority:1\nhttps://%s.ubuntu.com/ubuntu/\tpriority:2\n' "$archive" > "$mirrors"; \
sed -i -E "s#https?://$archive[.]ubuntu[.]com/ubuntu/?#mirror+file:$mirrors#g" /etc/apt/sources.list.d/ubuntu.sources; \
done; \
fi
RUN apt-get -o APT::Update::Error-Mode=any update && apt-get install -y --no-install-recommends \
python3-pip python3-venv python3-shapely libtcmalloc-minimal4 \
&& rm -rf /var/lib/apt/lists/*
# Venv with system-site-packages so GDAL Python bindings + numpy are inherited
RUN python3 -m venv /opt/venv --system-site-packages
ENV PATH="/opt/venv/bin:$PATH"
ENV LD_PRELOAD=libtcmalloc_minimal.so.4
COPY requirements.txt .
RUN pip install --no-cache-dir --require-hashes -r requirements.txt
# The external-consumer SQL checker is imported by the test suite below, so it
# must be in the image; scripts/ is outside this build context.
COPY *.py uk_mainland.json ./
COPY rf ./rf
COPY tests ./tests
RUN useradd --system --uid 10001 --home-dir /app meshcore \
&& mkdir -p /data/srtm \
&& chown -R meshcore:meshcore /app /data/srtm /opt/venv
USER 10001:10001
ARG SOURCE_REVISION=unknown
ARG UKMESH_VERSION=2.0.0
LABEL org.opencontainers.image.version="${UKMESH_VERSION}" \
org.opencontainers.image.revision="${SOURCE_REVISION}" \
org.opencontainers.image.source="https://github.com/gadgethd/ukmesh"
EXPOSE 9091
CMD ["python3", "-u", "worker.py"]