-
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (46 loc) · 2.12 KB
/
Copy pathDockerfile
File metadata and controls
62 lines (46 loc) · 2.12 KB
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
55
56
57
58
59
60
61
62
# Multi-stage Dockerfile for localtileserver
#
# Targets:
# slim - minimal server image (default)
# jupyter - JupyterLab with localtileserver pre-installed
#
# Usage:
# docker build -t localtileserver . # slim (default)
# docker build -t localtileserver-jupyter --target jupyter .
#
# docker run --rm -it -p 8000:8000 localtileserver
# docker run --rm -it -p 8888:8888 localtileserver-jupyter
# ---- shared base: install the package once ----
FROM python:3.12-slim AS base
LABEL maintainer="Bane Sullivan"
LABEL repo="https://github.com/banesullivan/localtileserver"
# libexpat1 is required at runtime by the GDAL bundled in the rasterio wheel
RUN apt-get update && apt-get install -y --no-install-recommends \
libexpat1 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build-context
RUN python -m pip install --upgrade --no-cache-dir pip
# Version is computed by setuptools_scm from git, which isn't available inside
# the build context. Pass it in as a build arg (the CI workflow derives it from
# the checked-out repo); the default is a safe placeholder for ad-hoc builds.
ARG SETUPTOOLS_SCM_PRETEND_VERSION_FOR_LOCALTILESERVER=0.0.0+docker
ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_LOCALTILESERVER=${SETUPTOOLS_SCM_PRETEND_VERSION_FOR_LOCALTILESERVER}
COPY pyproject.toml README.md /build-context/
COPY localtileserver/ /build-context/localtileserver/
# ``jupyter-config/`` is referenced by ``[tool.setuptools.data-files]``
# in pyproject.toml; the jupyter-server auto-enable JSON lands at
# /etc/jupyter/jupyter_server_config.d/ on install.
COPY jupyter-config/ /build-context/jupyter-config/
# ---- slim: server-only image (default) ----
FROM base AS slim
RUN pip install --no-cache-dir "/build-context[colormaps]"
EXPOSE 8000
ENTRYPOINT ["uvicorn", "localtileserver.web.wsgi:app", "--host=0.0.0.0", "--port=8000", "--workers=4"]
# ---- jupyter: full JupyterLab image ----
FROM base AS jupyter
RUN pip install --no-cache-dir "/build-context[all,test]" jupyterlab
ENV JUPYTER_ENABLE_LAB=yes
WORKDIR /home
COPY example.ipynb /home/
EXPOSE 8888
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--no-browser", "--allow-root"]