Skip to content

Commit 488c51b

Browse files
Install base Swift toolchain
1 parent 7932408 commit 488c51b

File tree

4 files changed

+169
-0
lines changed

4 files changed

+169
-0
lines changed

swift-ci/main/amazon-linux/2/Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,50 @@ RUN mkdir -p /usr/local/lib/python3.7/site-packages/
4848

4949
RUN easy_install-3.7 six
5050

51+
ARG SWIFT_PLATFORM=amazonlinux2
52+
ARG SWIFT_VERSION=5.8.1
53+
ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release
54+
ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE
55+
ARG SWIFT_WEBROOT=https://download.swift.org
56+
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}
57+
58+
ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
59+
SWIFT_VERSION=$SWIFT_VERSION \
60+
SWIFT_BRANCH=$SWIFT_BRANCH \
61+
SWIFT_TAG=$SWIFT_TAG \
62+
SWIFT_WEBROOT=$SWIFT_WEBROOT \
63+
SWIFT_PREFIX=$SWIFT_PREFIX
64+
65+
RUN set -e; \
66+
ARCH_NAME="$(rpm --eval '%{_arch}')"; \
67+
url=; \
68+
case "${ARCH_NAME##*-}" in \
69+
'x86_64') \
70+
OS_ARCH_SUFFIX=''; \
71+
;; \
72+
'aarch64') \
73+
OS_ARCH_SUFFIX='-aarch64'; \
74+
;; \
75+
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
76+
esac; \
77+
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)$OS_ARCH_SUFFIX" \
78+
&& SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_TAG/$SWIFT_TAG-$SWIFT_PLATFORM$OS_ARCH_SUFFIX.tar.gz" \
79+
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
80+
&& echo $SWIFT_BIN_URL \
81+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
82+
&& export GNUPGHOME="$(mktemp -d)" \
83+
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
84+
&& curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \
85+
&& gpg --batch --verify swift.tar.gz.sig swift.tar.gz \
86+
# - Unpack the toolchain, set libs permissions, and clean up.
87+
&& mkdir -p $SWIFT_PREFIX \
88+
&& tar -xzf swift.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
89+
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
90+
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz
91+
92+
ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
93+
94+
5195
COPY ./swift-ci/main/install-extra-packages.sh /tmp/install-extra-packages.sh
5296
RUN /tmp/install-extra-packages.sh cmake sccache && rm /tmp/install-extra-packages.sh
5397

swift-ci/main/ubuntu/18.04/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,40 @@ RUN apt -y update && apt -y install \
3333
unzip \
3434
uuid-dev
3535

36+
ARG SWIFT_PLATFORM=ubuntu18.04
37+
ARG SWIFT_VERSION=5.8.1
38+
ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release
39+
ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE
40+
ARG SWIFT_WEBROOT=https://download.swift.org
41+
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}
42+
43+
ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
44+
SWIFT_VERSION=$SWIFT_VERSION \
45+
SWIFT_BRANCH=$SWIFT_BRANCH \
46+
SWIFT_TAG=$SWIFT_TAG \
47+
SWIFT_WEBROOT=$SWIFT_WEBROOT \
48+
SWIFT_PREFIX=$SWIFT_PREFIX
49+
50+
RUN set -e; \
51+
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)" \
52+
&& SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_TAG/$SWIFT_TAG-$SWIFT_PLATFORM.tar.gz" \
53+
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
54+
# - Grab curl here so we cache better up above
55+
&& export DEBIAN_FRONTEND=noninteractive \
56+
&& apt-get -q update && apt-get -q install -y curl && rm -rf /var/lib/apt/lists/* \
57+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
58+
&& export GNUPGHOME="$(mktemp -d)" \
59+
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
60+
&& curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \
61+
&& gpg --batch --verify swift.tar.gz.sig swift.tar.gz \
62+
# - Unpack the toolchain, set libs permissions, and clean up.
63+
&& mkdir -p $SWIFT_PREFIX \
64+
&& tar -xzf swift.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
65+
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
66+
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz
67+
68+
ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
69+
3670
RUN apt-get install -y \
3771
# FIXME(katei): curl cli dependency is required for downloading build-sdk at build-time
3872
curl

swift-ci/main/ubuntu/20.04/Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,52 @@ RUN apt-get -y update && apt-get -y install \
3131
tzdata \
3232
unzip \
3333
uuid-dev
34+
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+
78+
ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
79+
3480
RUN apt-get install -y \
3581
# FIXME(katei): curl cli dependency is required for downloading build-sdk at build-time
3682
curl

swift-ci/main/ubuntu/22.04/Dockerfile

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

35+
ARG SWIFT_PLATFORM=ubuntu22.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+
78+
ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
79+
3580
RUN apt-get install -y \
3681
# FIXME(katei): curl cli dependency is required for downloading build-sdk at build-time
3782
curl

0 commit comments

Comments
 (0)