Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·105 lines (91 loc) · 3.13 KB
/
Copy pathDockerfile
File metadata and controls
executable file
·105 lines (91 loc) · 3.13 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# ===== Base Stage =====
FROM ubuntu:22.04 AS base
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG SNAP_SKIP_UPDATES=1
ENV JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
ENV SNAP_HOME="/workspace/snap13"
ENV SNAP_SKIP_UPDATES="${SNAP_SKIP_UPDATES}"
ENV PATH="${PATH}:${SNAP_HOME}/bin"
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PIP_NO_CACHE_DIR=1
# Install shared system dependencies once for SNAP + Python runtime.
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
software-properties-common \
gnupg \
gpg-agent \
lsb-release \
&& add-apt-repository -y ppa:deadsnakes/ppa \
&& add-apt-repository -y ppa:openjdk-r/ppa \
&& apt-get update && apt-get install -y --no-install-recommends \
locales \
python3.11 \
python3.11-venv \
python3.11-dev \
curl \
wget \
git \
build-essential \
gfortran \
openjdk-8-jdk \
gdal-bin \
libgdal30 \
libfftw3-dev \
libtiff5-dev \
libgfortran5 \
jblas \
libhdf5-dev \
libxml2-dev \
libxslt1-dev \
libproj-dev \
libgeos-dev \
&& locale-gen en_US.UTF-8 \
&& update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean \
&& rm -rf /tmp/* /var/tmp/*
# Create Python aliases expected by scripts and users.
RUN ln -sf /usr/bin/python3.11 /usr/bin/python3 && \
ln -sf /usr/bin/python3.11 /usr/bin/python
# Install pip for Python 3.11.
RUN curl -fsSL https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py && \
python3.11 /tmp/get-pip.py && \
rm -f /tmp/get-pip.py
WORKDIR /workspace
# ===== SNAP Stage =====
FROM base AS snap
ARG SNAP_VERSION=13.0.0
ENV SNAP_HOME="/snap13"
ENV PATH="${PATH}:${SNAP_HOME}/bin"
ENV SNAP_SKIP_SYSTEM_PACKAGES=1
COPY support/snap-install.sh /tmp/snap-install.sh
COPY support/snap.varfile /tmp/snap.varfile
RUN SNAP_MAJOR="${SNAP_VERSION%%.*}" \
&& sed -i "s/^VERSION=.*/VERSION=${SNAP_MAJOR}/" /tmp/snap-install.sh \
&& sed -i "s|^sys.installationDir=.*|sys.installationDir=${SNAP_HOME}|" /tmp/snap.varfile \
&& chmod +x /tmp/snap-install.sh \
&& /tmp/snap-install.sh -v \
&& rm -f /tmp/snap-install.sh /tmp/snap.varfile
# ===== Runtime Stage =====
FROM base
# Bring SNAP installation from the dedicated SNAP stage into the final image.
COPY --from=snap /snap13 /workspace/snap13
RUN ln -sf /workspace/snap13/bin/snap /usr/local/bin/snap && \
ln -sf /workspace/snap13/bin/gpt /usr/local/bin/gpt
COPY README.md pyproject.toml ./
COPY sarpyx ./sarpyx
# Install sarpyx once in the final image.
RUN python3.11 -m pip install --upgrade pip setuptools wheel && \
python3.11 -m pip install --no-cache-dir ".[geo,io,processing,viz]" && \
python3.11 -c "import sarpyx; print('sarpyx installed successfully')" && \
rm -rf /tmp/* /var/tmp/*
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
COPY start-jupyter.sh /usr/local/bin/start-jupyter.sh
RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/start-jupyter.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["/bin/bash"]