|
| 1 | +FROM ubuntu:20.04 |
| 2 | +LABEL maintainer= "Swift Infrastructure <[email protected]>" |
| 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 | + binutils \ |
| 8 | + git \ |
| 9 | + gnupg2 \ |
| 10 | + libc6-dev \ |
| 11 | + libcurl4 \ |
| 12 | + libedit2 \ |
| 13 | + libgcc-9-dev \ |
| 14 | + libpython2.7 \ |
| 15 | + libsqlite3-0 \ |
| 16 | + libstdc++-9-dev \ |
| 17 | + libxml2 \ |
| 18 | + libz3-dev \ |
| 19 | + pkg-config \ |
| 20 | + tzdata \ |
| 21 | + zlib1g-dev \ |
| 22 | + && rm -r /var/lib/apt/lists/* |
| 23 | + |
| 24 | +# Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little |
| 25 | + |
| 26 | +# pub 4096R/ED3D1561 2019-03-22 [expires: 2021-03-21] |
| 27 | +# Key fingerprint = A62A E125 BBBF BB96 A6E0 42EC 925C C1CC ED3D 1561 |
| 28 | +# uid Swift 5.x Release Signing Key <[email protected] |
| 29 | +ARG SWIFT_SIGNING_KEY=A62AE125BBBFBB96A6E042EC925CC1CCED3D1561 |
| 30 | +ARG SWIFT_PLATFORM=ubuntu20.04 |
| 31 | +ARG SWIFT_BRANCH=swift-5.2.4-release |
| 32 | +ARG SWIFT_VERSION=swift-5.2.4-RELEASE |
| 33 | +ARG SWIFT_WEBROOT=https://swift.org/builds/ |
| 34 | + |
| 35 | +ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \ |
| 36 | + SWIFT_PLATFORM=$SWIFT_PLATFORM \ |
| 37 | + SWIFT_BRANCH=$SWIFT_BRANCH \ |
| 38 | + SWIFT_VERSION=$SWIFT_VERSION \ |
| 39 | + SWIFT_WEBROOT=$SWIFT_WEBROOT |
| 40 | + |
| 41 | +RUN set -e; \ |
| 42 | + SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)/" \ |
| 43 | + && SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_VERSION/$SWIFT_VERSION-$SWIFT_PLATFORM.tar.gz" \ |
| 44 | + && SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \ |
| 45 | + # - Grab curl here so we cache better up above |
| 46 | + && export DEBIAN_FRONTEND=noninteractive \ |
| 47 | + && apt-get -q update && apt-get -q install -y curl && rm -rf /var/lib/apt/lists/* \ |
| 48 | + # - Download the GPG keys, Swift toolchain, and toolchain signature, and verify. |
| 49 | + && export GNUPGHOME="$(mktemp -d)" \ |
| 50 | + && curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \ |
| 51 | + && gpg --batch --quiet --keyserver ha.pool.sks-keyservers.net --recv-keys "$SWIFT_SIGNING_KEY" \ |
| 52 | + && gpg --batch --verify swift.tar.gz.sig swift.tar.gz \ |
| 53 | + # - Unpack the toolchain, set libs permissions, and clean up. |
| 54 | + && tar -xzf swift.tar.gz --directory / --strip-components=1 \ |
| 55 | + && chmod -R o+r /usr/lib/swift \ |
| 56 | + && rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz \ |
| 57 | + && apt-get purge --auto-remove -y curl |
| 58 | + |
| 59 | +# Print Installed Swift Version |
| 60 | +RUN swift --version |
0 commit comments