-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDockerfile
More file actions
75 lines (64 loc) · 2.21 KB
/
Copy pathDockerfile
File metadata and controls
75 lines (64 loc) · 2.21 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
63
64
65
66
67
68
69
70
71
72
73
74
75
# ------------------------------
# Base image from Jupyter stack
# ------------------------------
FROM quay.io/jupyter/base-notebook:latest
# # ------------------------------
# # 1. Switch to root to install system packages
# # ------------------------------
# USER root
# RUN apt-get update && \
# apt-get install -y --no-install-recommends \
# git \
# && apt-get clean && rm -rf /var/lib/apt/lists/*
# # ------------------------------
# # 2. Install conda packages into base env
# # ------------------------------
# RUN mamba install -n base -c conda-forge -y \
# gdal \
# proj \
# geos \
# rasterio \
# pyproj \
# fiona \
# geopandas \
# rioxarray \
# maplibre \
# pmtiles \
# flask \
# flask-cors \
# localtileserver \
# jupyter-server-proxy \
# leafmap \
# && mamba clean --all --yes \
# && fix-permissions $CONDA_DIR
# # ------------------------------
# # 3. Set geospatial environment variables
# # ------------------------------
# ENV PROJ_LIB=$CONDA_DIR/share/proj \
# GDAL_DATA=$CONDA_DIR/share/gdal \
# LOCALTILESERVER_CLIENT_PREFIX='proxy/{port}'
# ------------------------------
# 4. Copy source code after env setup
# ------------------------------
USER root
COPY . /home/jovyan/mapwidget
RUN chown -R $NB_UID:$NB_GID /home/jovyan/mapwidget
WORKDIR /home/jovyan/mapwidget
# ------------------------------
# 5. Install leafmap from source
# ------------------------------
# Prevent version resolution errors in CI
ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MAPWIDGET=0.0.0
USER $NB_UID
RUN pip install . && \
rm -rf ./build ./dist *.egg-info && \
mkdir -p /home/jovyan/work && \
fix-permissions /home/jovyan
# ------------------------------
# 6. Switch back to default user
# ------------------------------
WORKDIR /home/jovyan
# ------------------------------
# Usage:
# docker run -it -p 8888:8888 -v $(pwd):/home/jovyan/work ghcr.io/opengeos/mapwidget:latest
# ------------------------------