Skip to content

Multistage Docker / Ubuntu 22.04 WIP #1672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ubuntu 22.04 WIP
  • Loading branch information
dokterbob committed May 16, 2025
commit 2780eade67a6964f65e4ff25f1fa11f7b6151e04
59 changes: 30 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM ubuntu:21.04
FROM ubuntu:22.04
LABEL maintainer="Piero Toffanin <[email protected]>"

ARG TEST_BUILD
Expand All @@ -10,20 +10,10 @@ ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=$WORKDIR
ENV PROJ_LIB=/usr/share/proj
ENV NODE_MAJOR=20
ENV RELEASE_CODENAME=jammy

#### Common setup ####

# Old-releases for 21.04
COPY <<EOF /etc/apt/sources.list
deb http://old-releases.ubuntu.com/ubuntu/ hirsute main restricted
deb http://old-releases.ubuntu.com/ubuntu/ hirsute-updates main restricted
deb http://old-releases.ubuntu.com/ubuntu/ hirsute universe
deb http://old-releases.ubuntu.com/ubuntu/ hirsute-updates universe
deb http://old-releases.ubuntu.com/ubuntu/ hirsute multiverse
deb http://old-releases.ubuntu.com/ubuntu/ hirsute-updates multiverse
deb http://old-releases.ubuntu.com/ubuntu/ hirsute-backports main restricted universe multiverse
EOF

# Create and change into working directory
WORKDIR $WORKDIR

Expand All @@ -38,42 +28,53 @@ SHELL ["sh", "-exc"]

RUN <<EOT
# Common system configuration, should change very infrequently
# Default to 3 retries for apt-get acquire's.
# Remove in apt 2.3.2 where 3 tries is default.
# Ref: https://askubuntu.com/questions/875213/apt-get-to-retry-downloading
echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries
# Set timezone to UTC
echo "UTC" > /etc/timezone
# Build-time dependencies
apt-get -qq update
apt-get -qq install -y --no-install-recommends curl
apt-get install -y ca-certificates gnupg
apt-get install -y ca-certificates gnupg software-properties-common
# Enable universe, for pdal
add-apt-repository universe
# Python 3.9 support
add-apt-repository ppa:deadsnakes/ppa
# Node.js deb source
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/nodesource.gpg
echo "deb https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" > /etc/apt/sources.list.d/nodesource.list
# Postgres 13
# curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
# echo "deb http://apt.postgresql.org/pub/repos/apt $RELEASE_CODENAME-pgdg main" > /etc/apt/sources.list.d/postgresql.list
# Update package list
apt-get -qq update
apt-get update
# Install common deps, starting with NodeJS
apt-get -qq install -y nodejs
# Python3, GDAL, PDAL, nginx, letsencrypt, psql
apt-get -qq install -y --no-install-recommends \
python3 python3-pip python3-setuptools python3-wheel git binutils libproj-dev gdal-bin pdal \
libgdal-dev python3-gdal nginx certbot gettext-base cron postgresql-client-13 gettext tzdata
# Python3 with priority 1 (default)
update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
# Python3.9, GDAL, PDAL, nginx, letsencrypt, psql
apt-get install -y --no-install-recommends \
python3.9 python3.9-venv git binutils libproj-dev gdal-bin pdal \
libgdal-dev nginx certbot gettext-base cron postgresql-client gettext tzdata
# Create virtualenv
python3.9 -m venv $WORKDIR/venv
EOT

# Modify PATH to prioritize venv, effectively activating venv
ENV PATH="$WORKDIR/venv/bin:$PATH"

RUN <<EOT
# Install Python dependencies
# Install pip
pip install pip==24.0
# Install webpack, webpack CLI
# Note webpack CLI is also used in `rebuildplugins` below
npm install --quiet -g [email protected]
npm install --quiet -g [email protected]
# Build-only deps
apt-get -qq install -y --no-install-recommends g++ python3-dev libpq-dev
apt-get -qq install -y --no-install-recommends g++ python3.9-dev libpq-dev
# Install Python requirements
pip install -r requirements.txt "boto3==1.14.14"

RUN <<EOT
# Cleanup of build requirements
apt-get remove -y g++ python3-dev libpq-dev
apt-get remove -y g++ python3.9-dev libpq-dev
apt-get autoremove -y
apt-get clean
rm -rf /var/lib/apt/lists/*
Expand Down