Skip to content

Commit 86dc3fb

Browse files
committed
Make the base URL used for downloads configurable and restore signature verification (we now default to auto-signing key #2, which is also now configurable). Slightly rearranges the way the shell command is handled in the process.
1 parent 9c7353c commit 86dc3fb

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

5.1/ubuntu/18.04/Dockerfile

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,24 @@ ARG SWIFT_SIGNING_KEY=8513444E2DA36B7C1659AF4D7638F1FB2B2B08C4
2929
ARG SWIFT_PLATFORM=ubuntu18.04
3030
ARG SWIFT_BRANCH=swift-5.1-branch
3131
ARG SWIFT_VERSION=swift-5.1-DEVELOPMENT-SNAPSHOT-2019-08-24-a
32+
ARG SWIFT_WEBROOT=https://swift.org/builds/
3233

3334
ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \
3435
SWIFT_PLATFORM=$SWIFT_PLATFORM \
3536
SWIFT_BRANCH=$SWIFT_BRANCH \
36-
SWIFT_VERSION=$SWIFT_VERSION
37+
SWIFT_VERSION=$SWIFT_VERSION \
38+
SWIFT_WEBROOT=$SWIFT_WEBROOT
3739

38-
# Download GPG keys, signature and Swift package, then unpack, cleanup and execute permissions for foundation libs
39-
RUN SWIFT_URL=https://swift.org/builds/$SWIFT_BRANCH/$(echo "$SWIFT_PLATFORM" | tr -d .)/$SWIFT_VERSION/$SWIFT_VERSION-$SWIFT_PLATFORM.tar.gz \
40-
&& curl -fSsL $SWIFT_URL -o swift.tar.gz \
41-
# && curl -fSsL $SWIFT_URL.sig -o swift.tar.gz.sig \
42-
# && export GNUPGHOME="$(mktemp -d)" \
43-
# && set -e; \
44-
# for key in \
45-
# # pub 4096R/ED3D1561 2019-03-22 [expires: 2021-03-21]
46-
# # Key fingerprint = A62A E125 BBBF BB96 A6E0 42EC 925C C1CC ED3D 1561
47-
# # uid Swift 5.x Release Signing Key <[email protected]
48-
# A62AE125BBBFBB96A6E042EC925CC1CCED3D1561 \
49-
# ; do \
50-
# gpg --quiet --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
51-
# done \
52-
# && gpg --batch --verify --quiet swift.tar.gz.sig swift.tar.gz \
40+
RUN set -e; \
41+
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)/" \
42+
&& SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_VERSION/$SWIFT_VERSION-$SWIFT_PLATFORM.tar.gz" \
43+
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
44+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
45+
&& export GNUPGHOME="$(mktemp -d)" \
46+
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
47+
&& gpg --batch --quiet --keyserver ha.pool.sks-keyservers.net --recv-keys "$SWIFT_SIGNING_KEY" \
48+
&& gpg --batch --quiet --verify swift.tar.gz.sig swift.tar.gz \
49+
# - Unpack the toolchain, set libs permissions, and clean up.
5350
&& tar -xzf swift.tar.gz --directory / --strip-components=1 \
5451
&& chmod -R o+r /usr/lib/swift \
5552
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz \

0 commit comments

Comments
 (0)