Skip to content

Commit d409dd7

Browse files
committed
Update snap image
1 parent 741136b commit d409dd7

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

Dockerfile.snap

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG RISK=stable
2-
ARG UBUNTU=jammy
2+
ARG UBUNTU=noble
33

4-
FROM ubuntu:$UBUNTU as builder
4+
FROM ubuntu:$UBUNTU AS builder
55
ARG RISK
66
ARG UBUNTU
77
RUN echo "Building snapcraft:$RISK in ubuntu:$UBUNTU"
@@ -10,15 +10,15 @@ RUN echo "Building snapcraft:$RISK in ubuntu:$UBUNTU"
1010
RUN apt-get update
1111
RUN apt-get dist-upgrade --yes
1212
RUN apt-get install --yes \
13-
curl \
14-
jq \
15-
squashfs-tools
13+
curl \
14+
jq \
15+
squashfs-tools
1616

17-
# Grab the core22 snap (which snapcraft uses as a base) from the stable channel
17+
# Grab the core24 snap (which snapcraft uses as a base) from the stable channel
1818
# and unpack it in the proper place.
19-
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
20-
RUN mkdir -p /snap/core22
21-
RUN unsquashfs -d /snap/core22/current core22.snap
19+
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
20+
RUN mkdir -p /snap/core24
21+
RUN unsquashfs -d /snap/core24/current core24.snap
2222

2323
# Grab the snapcraft snap from the $RISK channel and unpack it in the proper
2424
# place.
@@ -30,14 +30,18 @@ RUN unsquashfs -d /snap/snapcraft/current snapcraft.snap
3030
# the snapcraft snap:
3131
RUN unlink /snap/snapcraft/current/usr/bin/python3
3232
RUN ln -s /snap/snapcraft/current/usr/bin/python3.* /snap/snapcraft/current/usr/bin/python3
33+
RUN mkdir -p /snap/snapcraft/current/usr/lib/python3/dist-packages
3334
RUN echo /snap/snapcraft/current/lib/python3.*/site-packages >> /snap/snapcraft/current/usr/lib/python3/dist-packages/site-packages.pth
35+
RUN site_pkgs=$(echo /snap/snapcraft/current/lib/python3.*/site-packages) && \
36+
ln -s /snap/snapcraft/current/share/snapcraft/extensions $site_pkgs/extensions && \
37+
ln -s /snap/snapcraft/current/share/snapcraft/keyrings $site_pkgs/keyrings && \
38+
ln -s /snap/snapcraft/current/share/snapcraft/schema $site_pkgs/schema
3439

35-
# Create a snapcraft runner (TODO: move version detection to the core of
36-
# snapcraft).
40+
# Create a snapcraft runner
3741
RUN mkdir -p /snap/bin
3842
RUN echo "#!/bin/sh" > /snap/bin/snapcraft
3943
RUN snap_version="$(awk '/^version:/{print $2}' /snap/snapcraft/current/meta/snap.yaml | tr -d \')" && echo "export SNAP_VERSION=\"$snap_version\"" >> /snap/bin/snapcraft
40-
RUN echo 'exec "$SNAP/usr/bin/python3" "$SNAP/bin/snapcraft" "$@"' >> /snap/bin/snapcraft
44+
RUN echo 'exec "/snap/snapcraft/current/bin/python3" -m snapcraft "$@"' >> /snap/bin/snapcraft
4145
RUN chmod +x /snap/bin/snapcraft
4246

4347
# Workaround for old buggy version of patchelf
@@ -72,7 +76,7 @@ RUN echo 'Patcher._old_run_patchelf = Patcher._run_patchelf' >> /opt/patchelf/_p
7276
# Multi-stage build, only need the snaps from the builder. Copy them one at a
7377
# time so they can be cached.
7478
FROM ubuntu:$UBUNTU
75-
COPY --from=builder /snap/core22 /snap/core22
79+
COPY --from=builder /snap/core24 /snap/core24
7680
COPY --from=builder /snap/snapcraft /snap/snapcraft
7781
COPY --from=builder /snap/bin/snapcraft /snap/bin/snapcraft
7882
COPY --from=builder /opt/patchelf/bin/patchelf /snap/snapcraft/current/bin
@@ -85,7 +89,5 @@ RUN apt-get update && apt-get dist-upgrade --yes && apt-get install --yes snapd
8589
ENV LANG="en_US.UTF-8"
8690
ENV LANGUAGE="en_US:en"
8791
ENV LC_ALL="en_US.UTF-8"
88-
ENV PATH="/snap/bin:/snap/snapcraft/current/usr/bin:$PATH"
89-
ENV SNAP="/snap/snapcraft/current"
90-
ENV SNAP_NAME="snapcraft"
91-
ENV SNAP_ARCH="amd64"
92+
ENV PATH="/snap/snapcraft/current/libexec/snapcraft/:/snap/bin:$PATH"
93+
ENV SNAPCRAFT_BUILD_ENVIRONMENT=host

0 commit comments

Comments
 (0)