1+ FROM ubuntu:20.04
2+ LABEL maintainer="Swift Infrastructure <swift-infrastructure@swift.org>"
3+ LABEL description="Docker Container for the Swift programming language"
4+
5+ RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && apt-get -q update && \
6+ apt-get -q install -y \
7+ libcurl4 \
8+ libxml2 \
9+ tzdata \
10+ && rm -r /var/lib/apt/lists/*
11+
12+ # Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little
13+
14+ # pub 4096R/ED3D1561 2019-03-22 [expires: 2021-03-21]
15+ # Key fingerprint = A62A E125 BBBF BB96 A6E0 42EC 925C C1CC ED3D 1561
16+ # uid Swift 5.x Release Signing Key <swift-infrastructure@swift.org
17+ ARG SWIFT_SIGNING_KEY=A62AE125BBBFBB96A6E042EC925CC1CCED3D1561
18+ ARG SWIFT_PLATFORM=ubuntu20.04
19+ ARG SWIFT_BRANCH=swift-5.2.4-release
20+ ARG SWIFT_VERSION=swift-5.2.4-RELEASE
21+ ARG SWIFT_WEBROOT=https://swift.org/builds/
22+
23+ ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \
24+ SWIFT_PLATFORM=$SWIFT_PLATFORM \
25+ SWIFT_BRANCH=$SWIFT_BRANCH \
26+ SWIFT_VERSION=$SWIFT_VERSION \
27+ SWIFT_WEBROOT=$SWIFT_WEBROOT
28+
29+ RUN set -e; \
30+ SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)/" \
31+ && SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_VERSION/$SWIFT_VERSION-$SWIFT_PLATFORM.tar.gz" \
32+ && SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
33+ # - Grab curl and gpg here so we cache better up above
34+ && export DEBIAN_FRONTEND=noninteractive \
35+ && apt-get -q update && apt-get -q install -y curl gnupg && rm -rf /var/lib/apt/lists/* \
36+ # - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
37+ && export GNUPGHOME="$(mktemp -d)" \
38+ && curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
39+ && gpg --batch --quiet --keyserver ha.pool.sks-keyservers.net --recv-keys "$SWIFT_SIGNING_KEY" \
40+ && gpg --batch --verify swift.tar.gz.sig swift.tar.gz \
41+ # - Unpack the toolchain, set libs permissions, and clean up.
42+ && tar -xzf swift.tar.gz --directory / --strip-components=1 $SWIFT_VERSION-$SWIFT_PLATFORM/usr/lib/swift/linux \
43+ && chmod -R o+r /usr/lib/swift \
44+ && rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz \
45+ && apt-get purge --auto-remove -y curl gnupg
0 commit comments