diff --git a/Dockerfile b/Dockerfile index 93e8db2..a807f53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM python:3.11.4-slim-bullseye +FROM python:3.11.4-bullseye as builder + LABEL maintainer="NSGI " COPY . /src @@ -6,21 +7,29 @@ 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" ]