Files
jami-client-qt/extras/packaging/gnu-linux/docker/Dockerfile_snap
François-Simon Fauteux-Chapleau 25c9f0ef5c snap: use core22 as base
Use core22 (Ubuntu 22.04) instead of core20 (Ubuntu 20.04) as the base
for the snap build. This will allow us to stop building libqt-jami for
Ubuntu 20.04, which has reached its EOL.

The changes made in snapcraft.yaml are based on the following guide:
https://documentation.ubuntu.com/snapcraft/latest/how-to/change-bases/change-from-core20-to-core22/

GitLab: #1944
Change-Id: Ib1af9c28a1ca9d0c3b8e693c5b2e50fb6cbead64
2025-08-06 15:39:15 -04:00

66 lines
2.5 KiB
Plaintext

# This file is based on the examples at the following links:
# https://snapcraft.io/docs/build-on-docker
# https://github.com/canonical/snapcraft/issues/5079#issuecomment-2414199613
ARG UBUNTU=jammy
FROM ubuntu:$UBUNTU AS builder
ARG UBUNTU
RUN echo "Building snapcraft in ubuntu:$UBUNTU"
# Grab dependencies
RUN apt-get update
RUN apt-get dist-upgrade --yes
RUN apt-get install --yes \
curl \
jq \
squashfs-tools
# Download and unpack the core22 snap
RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core22' | jq '.download_url' -r) --output core22.snap
RUN mkdir -p /snap/core22
RUN unsquashfs -d /snap/core22/current core22.snap
# Download and unpack the core24 snap
RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core24' | jq '.download_url' -r) --output core24.snap
RUN mkdir -p /snap/core24
RUN unsquashfs -d /snap/core24/current core24.snap
# Download and unpack snapcraft
RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/snapcraft' | jq '.download_url' -r) --output snapcraft.snap
RUN mkdir -p /snap/snapcraft
RUN unsquashfs -d /snap/snapcraft/current snapcraft.snap
# Create a snapcraft runner
RUN mkdir -p /snap/bin
RUN echo "#!/bin/sh" > /snap/bin/snapcraft
RUN snap_version="$(awk '/^version:/{print $2}' /snap/snapcraft/current/meta/snap.yaml | tr -d \')" && echo "export SNAP_VERSION=\"$snap_version\"" >> /snap/bin/snapcraft
RUN echo 'exec "/snap/snapcraft/current/bin/python3" -m snapcraft "$@"' >> /snap/bin/snapcraft
RUN chmod +x /snap/bin/snapcraft
# Multi-stage build, only need the snaps from the builder. Copy them one at a
# time so they can be cached.
FROM ubuntu:$UBUNTU
COPY --from=builder /snap/core22 /snap/core22
COPY --from=builder /snap/core24 /snap/core24
COPY --from=builder /snap/snapcraft /snap/snapcraft
COPY --from=builder /snap/bin/snapcraft /snap/bin/snapcraft
# Generate locale and install dependencies.
RUN apt-get update && apt-get dist-upgrade --yes && apt-get install --yes snapd sudo apt-transport-https locales wget && locale-gen en_US.UTF-8
# Set the proper environment.
ENV LANG="en_US.UTF-8"
ENV LANGUAGE="en_US:en"
ENV LC_ALL="en_US.UTF-8"
ENV PATH="/snap/bin:/snap/snapcraft/current/usr/bin:/snap/snapcraft/current/libexec/snapcraft/:$PATH"
ENV SNAP="/snap/snapcraft/current"
ENV SNAP_NAME="snapcraft"
ENV SNAP_ARCH="amd64"
ENV SNAPCRAFT_BUILD_ENVIRONMENT=host
ADD extras/packaging/gnu-linux/scripts/build-package-snap.sh /opt/build-package-snap.sh
CMD ["/opt/build-package-snap.sh"]