Skip to content

Commit 88941f8

Browse files
committed
To bring up Debian 11 use Swift compiler from ubuntu 20.04
1 parent f0ecc57 commit 88941f8

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

swift-ci/master/debian/11/Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,52 @@ RUN apt-get -y update && apt-get -y install \
3232
unzip \
3333
uuid-dev
3434

35+
ARG SWIFT_PLATFORM=ubuntu20.04
36+
ARG SWIFT_VERSION=5.8.1
37+
ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release
38+
ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE
39+
ARG SWIFT_WEBROOT=https://download.swift.org
40+
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}
41+
42+
ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
43+
SWIFT_VERSION=$SWIFT_VERSION \
44+
SWIFT_BRANCH=$SWIFT_BRANCH \
45+
SWIFT_TAG=$SWIFT_TAG \
46+
SWIFT_WEBROOT=$SWIFT_WEBROOT \
47+
SWIFT_PREFIX=$SWIFT_PREFIX
48+
49+
RUN set -e; \
50+
ARCH_NAME="$(dpkg --print-architecture)"; \
51+
url=; \
52+
case "${ARCH_NAME##*-}" in \
53+
'amd64') \
54+
OS_ARCH_SUFFIX=''; \
55+
;; \
56+
'arm64') \
57+
OS_ARCH_SUFFIX='-aarch64'; \
58+
;; \
59+
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
60+
esac; \
61+
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)$OS_ARCH_SUFFIX" \
62+
&& SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_TAG/$SWIFT_TAG-$SWIFT_PLATFORM$OS_ARCH_SUFFIX.tar.gz" \
63+
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
64+
# - Grab curl here so we cache better up above
65+
&& export DEBIAN_FRONTEND=noninteractive \
66+
&& apt-get -q update && apt-get -q install -y curl && rm -rf /var/lib/apt/lists/* \
67+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
68+
&& export GNUPGHOME="$(mktemp -d)" \
69+
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
70+
&& curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \
71+
&& gpg --batch --verify swift.tar.gz.sig swift.tar.gz \
72+
# - Unpack the toolchain, set libs permissions, and clean up.
73+
&& mkdir -p $SWIFT_PREFIX \
74+
&& tar -xzf swift.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
75+
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
76+
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz \
77+
&& apt-get purge --auto-remove -y curl
78+
79+
ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
80+
3581
USER build-user
3682

3783
WORKDIR /home/build-user

0 commit comments

Comments
 (0)