-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile.api
54 lines (45 loc) · 1.96 KB
/
Dockerfile.api
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
46
47
48
49
50
51
52
53
54
# =============================================================================
# This Dockerfile implements a Docker container to run GeodataFlow as WEB API.
#
# @Build:
# docker build -f ./Dockerfile.api -t geodataflow/api:1.0.0 .
# docker image rmi geodataflow/api:1.0.0
#
# @Env:
# PACKAGE_WITH_GEODATAFLOW_PIPELINE_CONTEXT="geodataflow.spatial"
#
# @Usage:
# To start in Linux:
# docker run --rm -it -p 9630:9630 -v "$PWD/geodataflow/spatial/tests/data:/tests/data" geodataflow/api:1.0.0
# To start in Windows:
# docker run --rm -it -p 9630:9630 -v "%cd%/geodataflow/spatial/tests/data:/tests/data" geodataflow/api:1.0.0
#
# =============================================================================
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.6.4
LABEL maintainer="Alvaro Huarte <[email protected]>"
# Active PipelineContext.
ARG PACKAGE_WITH_GEODATAFLOW_PIPELINE_CONTEXT="geodataflow.spatial"
ENV PACKAGE_WITH_GEODATAFLOW_PIPELINE_CONTEXT=${PACKAGE_WITH_GEODATAFLOW_PIPELINE_CONTEXT}
RUN echo "INFO: This Docker container provides the GeodataFlow API!"
RUN set -x && \
apt-get update && \
apt-get install -y python3-pip wget --no-install-recommends && \
apt-get autoclean && \
apt-get autoremove && \
rm -rf /var/lib/{apt,dpkg,cache,log}
# Include GeodataFlow.
COPY ./geodataflow/core/geodataflow /app/geodataflow
COPY ./geodataflow/spatial/geodataflow /app/geodataflow
COPY ./geodataflow/dataframes/geodataflow /app/geodataflow
COPY ./geodataflow/api/geodataflow /app/geodataflow
COPY ./geodataflow/api/requirements-dev.txt /app/requirements.txt
WORKDIR /app
# Clean existing "__pycache__" directories.
RUN find . -name "__pycache__" -type d -prune -exec rm -rf '{}' +
# Install python dependencies.
RUN pip3 install --no-cache-dir --requirement requirements.txt
RUN echo "INFO: Everything installed!"
RUN echo "INFO: You can run Geospatial workflows as a Service."
# Set entrypoint.
EXPOSE 9630
ENTRYPOINT ["uvicorn", "--port=9630", "geodataflow.pipelineapi:app"]