Skip to content

Commit e863dfb

Browse files
committed
Dockerfile: upgrade to Ubuntu 24.04
Switch to Ubuntu 24.04, bump some versions of dependencies, and use some of the packages from Ubuntu instead of building OpenCV manually. There is also an ubuntu user/group by default in the base image, so use that instead of creating a separate docker user like before. Refs #3
1 parent a6a3449 commit e863dfb

File tree

1 file changed

+16
-36
lines changed

1 file changed

+16
-36
lines changed

Dockerfile

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Fabian Lehmann
66
# Wilfried Weber
77

8-
FROM ubuntu:20.04 AS builder
8+
FROM ubuntu:24.04 AS builder
99

1010
# disable interactive frontends
1111
ENV DEBIAN_FRONTEND=noninteractive
@@ -54,29 +54,23 @@ apt-get -y install \
5454
libglpk-dev \
5555
libavcodec-dev \
5656
libavformat-dev \
57+
libopencv-dev \
5758
libswscale-dev \
58-
python3.8 \
59+
python3.12 \
5960
python3-pip \
61+
python-is-python3 \
6062
pandoc \
63+
parallel \
6164
libudunits2-dev \
6265
r-base \
6366
aria2 && \
64-
dpkg -r parallel && \
65-
wget http://de.archive.ubuntu.com/ubuntu/pool/universe/p/parallel/parallel_20210822+ds-2_all.deb && \
66-
dpkg -i parallel_20210822+ds-2_all.deb && \
67-
rm parallel_20210822+ds-2_all.deb && \
68-
# Set python aliases for Python 3.x
69-
echo 'alias python=python3' >> ~/.bashrc \
70-
&& echo 'alias pip=pip3' >> ~/.bashrc \
71-
&& . ~/.bashrc && \
7267
#
7368
# NumPy is needed for OpenCV, gsutil for level1-csd, landsatlinks for level1-landsat (requires gdal/requests/tqdm)
74-
pip3 install --no-cache-dir --upgrade pip && \
75-
pip3 install --no-cache-dir \
76-
numpy==1.18.1 \
69+
pip3 install --break-system-packages --no-cache-dir \
70+
numpy==1.26.4 \
7771
gsutil \
78-
scipy==1.6.0 \
79-
gdal==$(gdal-config --version | awk -F'[.]' '{print $1"."$2}') \
72+
scipy==1.14.1 \
73+
gdal==$(gdal-config --version) \
8074
git+https://github.com/ernstste/landsatlinks.git && \
8175
#
8276
# Install R packages
@@ -91,22 +85,12 @@ apt-get clean && rm -r /var/cache/ /root/.cache /tmp/Rtmp*
9185

9286
# Install folder
9387
ENV INSTALL_DIR=/opt/install/src \
94-
HOME=/home/docker \
95-
PATH="$PATH:/home/docker/bin"
88+
HOME=/home/ubuntu \
89+
PATH="$PATH:/home/ubuntu/bin"
9690

97-
# Build OpenCV from source
98-
RUN mkdir -p $INSTALL_DIR/opencv && cd $INSTALL_DIR/opencv && \
99-
wget https://github.com/opencv/opencv/archive/4.1.0.zip \
100-
&& unzip 4.1.0.zip && \
101-
mkdir -p $INSTALL_DIR/opencv/opencv-4.1.0/build && \
102-
cd $INSTALL_DIR/opencv/opencv-4.1.0/build && \
103-
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .. \
104-
&& make -j7 \
105-
&& make install \
106-
&& make clean && \
10791
#
10892
# Build SPLITS from source
109-
cd $INSTALL_DIR && \
93+
RUN mkdir -p $INSTALL_DIR && cd $INSTALL_DIR && \
11094
git clone https://bitbucket.org/smader/splits.git \
11195
&& cd splits && \
11296
libtoolize --force \
@@ -123,14 +107,10 @@ libtoolize --force \
123107
rm -rf $INSTALL_DIR
124108
#RUN apt-get purge -y --auto-remove apt-utils cmake git build-essential software-properties-common
125109

110+
RUN chgrp ubuntu /usr/local/bin && \
111+
install -d -o ubuntu -g ubuntu -m 755 /home/ubuntu/bin
126112

127-
# Create a dedicated 'docker' group and user
128-
RUN groupadd docker && \
129-
useradd -m docker -g docker -p docker && \
130-
chmod 0777 /home/docker && \
131-
chgrp docker /usr/local/bin && \
132-
mkdir -p /home/docker/bin && chown docker /home/docker/bin
133113
# Use this user by default
134-
USER docker
114+
USER ubuntu
135115

136-
WORKDIR /home/docker
116+
WORKDIR /home/ubuntu

0 commit comments

Comments
 (0)