Skip to content

Commit

Permalink
use multistage docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
arbakker committed Dec 6, 2023
1 parent ad6f85c commit bf663f2
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
FROM python:3.11.4-slim-bullseye
FROM python:3.11.4-bullseye as builder

LABEL maintainer="NSGI <[email protected]>"

COPY . /src

# ignore pip warning about running pip as root - since we are in a containerized sandboxed environment anyways...
ENV ENV PIP_ROOT_USER_ACTION=ignore

RUN apt-get update && \
apt-get install -y \
moreutils \
curl \
git && \
pip install --upgrade setuptools && \
WORKDIR /src

RUN pip install --upgrade setuptools && \
pip install --upgrade pip && \
pip install /src
pip install --upgrade build && \
python -m build

# TODO: investigate how to properly setup Dockerfile for production use
WORKDIR /tifs

RUN cd /usr/local/lib/python3.11/site-packages/pyproj/proj_dir/share/proj && \
curl -o nl_nsgi_nlgeo2018.tif https://cdn.proj.org/nl_nsgi_nlgeo2018.tif && \
RUN curl -o nl_nsgi_nlgeo2018.tif https://cdn.proj.org/nl_nsgi_nlgeo2018.tif && \
curl -o nl_nsgi_rdcorr2018.tif https://cdn.proj.org/nl_nsgi_rdcorr2018.tif && \
curl -o nl_nsgi_rdtrans2018.tif https://cdn.proj.org/nl_nsgi_rdtrans2018.tif


FROM python:3.11.4-slim-bullseye as runner

ENV ENV PIP_ROOT_USER_ACTION=ignore

COPY --from=builder /src/dist/coordinate_transformation_api-2*.whl .

RUN pip install coordinate_transformation_api-2*.whl

COPY --from=builder /tifs/* /usr/local/lib/python3.11/site-packages/pyproj/proj_dir/share/proj

EXPOSE 8000
ENTRYPOINT [ "ct-api" ]

0 comments on commit bf663f2

Please sign in to comment.