Skip to content

Commit 1e29964

Browse files
authored
Add support for Swift 6.3 nightly docker images (#515)
1 parent 316ca5e commit 1e29964

File tree

19 files changed

+1602
-0
lines changed

19 files changed

+1602
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
FROM amazonlinux:2
2+
LABEL maintainer="Swift Infrastructure <[email protected]>"
3+
LABEL description="Docker Container for the Swift programming language"
4+
5+
RUN yum -y install \
6+
binutils \
7+
gcc \
8+
git \
9+
glibc-static \
10+
gzip \
11+
libbsd \
12+
libcurl-devel \
13+
libedit \
14+
libicu \
15+
libsqlite \
16+
libstdc++-static \
17+
libuuid \
18+
libxml2-devel \
19+
openssl-devel \
20+
python3-libs \
21+
tar \
22+
tzdata \
23+
unzip \
24+
zip \
25+
zlib-devel
26+
27+
# Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little
28+
29+
# gpg --keyid-format LONG -k F167DF1ACF9CE069
30+
# pub rsa4096/F167DF1ACF9CE069 2021-11-08 [SC] [expires: 2025-11-09]
31+
# E813C892820A6FA13755B268F167DF1ACF9CE069
32+
# uid [ unknown] Swift Automatic Signing Key #4 <[email protected]>
33+
ARG SWIFT_SIGNING_KEY=E813C892820A6FA13755B268F167DF1ACF9CE069
34+
ARG SWIFT_PLATFORM=amazonlinux
35+
ARG OS_MAJOR_VER=2
36+
ARG SWIFT_WEBROOT=https://download.swift.org/swift-6.3-branch
37+
38+
ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \
39+
SWIFT_PLATFORM=$SWIFT_PLATFORM \
40+
OS_MAJOR_VER=$OS_MAJOR_VER \
41+
OS_VER=$SWIFT_PLATFORM$OS_MAJOR_VER \
42+
SWIFT_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM$OS_MAJOR_VER"
43+
44+
RUN echo "${SWIFT_WEBROOT}/latest-build.yml"
45+
46+
RUN set -e; \
47+
# - Latest Toolchain info
48+
export $(curl -s ${SWIFT_WEBROOT}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \
49+
&& export $(curl -s ${SWIFT_WEBROOT}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \
50+
&& export DOWNLOAD_DIR=$(echo $download | sed "s/-${OS_VER}.tar.gz//g") \
51+
&& echo $DOWNLOAD_DIR > .swift_tag \
52+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
53+
&& export GNUPGHOME="$(mktemp -d)" \
54+
&& curl -fsSL ${SWIFT_WEBROOT}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \
55+
${SWIFT_WEBROOT}/${DOWNLOAD_DIR}/${download_signature} -o latest_toolchain.tar.gz.sig \
56+
&& curl -fSsL --compressed https://swift.org/keys/all-keys.asc | gpg --import - \
57+
&& gpg --batch --verify latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \
58+
# - Unpack the toolchain, set libs permissions, and clean up.
59+
&& tar -xzf latest_toolchain.tar.gz --directory / --strip-components=1 \
60+
&& chmod -R o+r /usr/lib/swift \
61+
&& rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \
62+
63+
# Print Installed Swift Version
64+
RUN swift --version
65+
66+
RUN echo "[ -n \"\${TERM:-}\" -a -r /etc/motd ] && cat /etc/motd" >> /etc/bashrc; \
67+
( \
68+
printf "################################################################\n"; \
69+
printf "# %-60s #\n" ""; \
70+
printf "# %-60s #\n" "Swift Nightly Docker Image"; \
71+
printf "# %-60s #\n" "Tag: $(cat .swift_tag)"; \
72+
printf "# %-60s #\n" ""; \
73+
printf "################################################################\n" \
74+
) > /etc/motd
75+
76+
RUN echo 'source /etc/bashrc' >> /root/.bashrc
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
FROM amazonlinux:2 AS base
2+
LABEL maintainer="Swift Infrastructure <[email protected]>"
3+
LABEL description="Docker Container for the Swift programming language"
4+
5+
RUN yum -y install \
6+
binutils \
7+
gcc \
8+
git \
9+
glibc-static \
10+
gzip \
11+
libbsd \
12+
libcurl-devel \
13+
libedit \
14+
libicu \
15+
libsqlite \
16+
libstdc++-static \
17+
libuuid \
18+
libxml2-devel \
19+
openssl-devel \
20+
tar \
21+
tzdata \
22+
unzip \
23+
zip \
24+
zlib-devel
25+
26+
# Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little
27+
28+
# gpg --keyid-format LONG -k F167DF1ACF9CE069
29+
# pub rsa4096/F167DF1ACF9CE069 2021-11-08 [SC] [expires: 2025-11-09]
30+
# E813C892820A6FA13755B268F167DF1ACF9CE069
31+
# uid [ unknown] Swift Automatic Signing Key #4 <[email protected]>
32+
ARG SWIFT_SIGNING_KEY=E813C892820A6FA13755B268F167DF1ACF9CE069
33+
ARG SWIFT_PLATFORM=amazonlinux
34+
ARG OS_MAJOR_VER=2
35+
ARG SWIFT_WEBROOT=https://download.swift.org/swift-6.3-branch
36+
37+
# This is a small trick to enable if/else for arm64 and amd64.
38+
# Because of https://bugs.swift.org/browse/SR-14872 we need adjust tar options.
39+
FROM base AS base-amd64
40+
ARG OS_ARCH_SUFFIX=
41+
42+
FROM base AS base-arm64
43+
ARG OS_ARCH_SUFFIX=-aarch64
44+
45+
FROM base-$TARGETARCH AS final
46+
47+
ARG OS_VER=$SWIFT_PLATFORM$OS_MAJOR_VER$OS_ARCH_SUFFIX
48+
ARG PLATFORM_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM$OS_MAJOR_VER$OS_ARCH_SUFFIX"
49+
50+
RUN echo "${PLATFORM_WEBROOT}/latest-build.yml"
51+
52+
RUN set -e; \
53+
# - Latest Toolchain info
54+
export $(curl -s ${PLATFORM_WEBROOT}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \
55+
&& export $(curl -s ${PLATFORM_WEBROOT}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \
56+
&& export DOWNLOAD_DIR=$(echo $download | sed "s/-${OS_VER}.tar.gz//g") \
57+
&& echo $DOWNLOAD_DIR > .swift_tag \
58+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
59+
&& export GNUPGHOME="$(mktemp -d)" \
60+
&& curl -fsSL ${PLATFORM_WEBROOT}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \
61+
${PLATFORM_WEBROOT}/${DOWNLOAD_DIR}/${download_signature} -o latest_toolchain.tar.gz.sig \
62+
&& curl -fSsL --compressed https://swift.org/keys/all-keys.asc | gpg --import - \
63+
&& gpg --batch --verify latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \
64+
# - Unpack the toolchain, set libs permissions, and clean up.
65+
&& tar -xzf latest_toolchain.tar.gz --directory / --strip-components=1 \
66+
&& chmod -R o+r /usr/lib/swift \
67+
&& rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \
68+
69+
# Print Installed Swift Version
70+
RUN swift --version
71+
72+
RUN echo "[ -n \"\${TERM:-}\" -a -r /etc/motd ] && cat /etc/motd" >> /etc/bashrc; \
73+
( \
74+
printf "################################################################\n"; \
75+
printf "# %-60s #\n" ""; \
76+
printf "# %-60s #\n" "Swift Nightly Docker Image"; \
77+
printf "# %-60s #\n" "Tag: $(cat .swift_tag)"; \
78+
printf "# %-60s #\n" ""; \
79+
printf "################################################################\n" \
80+
) > /etc/motd
81+
82+
RUN echo 'source /etc/bashrc' >> /root/.bashrc
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
FROM amazonlinux:2
2+
LABEL maintainer="Swift Infrastructure <[email protected]>"
3+
LABEL description="Docker Container for the Swift programming language"
4+
5+
# Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little
6+
7+
# gpg --keyid-format LONG -k F167DF1ACF9CE069
8+
# pub rsa4096/F167DF1ACF9CE069 2021-11-08 [SC] [expires: 2025-11-09]
9+
# E813C892820A6FA13755B268F167DF1ACF9CE069
10+
# uid [ unknown] Swift Automatic Signing Key #4 <[email protected]>
11+
ARG SWIFT_SIGNING_KEY=E813C892820A6FA13755B268F167DF1ACF9CE069
12+
ARG SWIFT_PLATFORM=amazonlinux
13+
ARG OS_MAJOR_VER=2
14+
ARG SWIFT_WEBROOT=https://download.swift.org/swift-6.3-branch
15+
16+
ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \
17+
SWIFT_PLATFORM=$SWIFT_PLATFORM \
18+
OS_MAJOR_VER=$OS_MAJOR_VER \
19+
OS_VER=$SWIFT_PLATFORM$OS_MAJOR_VER \
20+
SWIFT_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM$OS_MAJOR_VER"
21+
22+
RUN echo "${SWIFT_WEBROOT}/latest-build.yml"
23+
24+
RUN set -e; \
25+
# - Latest Toolchain info
26+
export $(curl -s ${SWIFT_WEBROOT}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \
27+
&& export $(curl -s ${SWIFT_WEBROOT}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \
28+
&& export DOWNLOAD_DIR=$(echo $download | sed "s/-${OS_VER}.tar.gz//g") \
29+
&& echo $DOWNLOAD_DIR > .swift_tag \
30+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
31+
&& export GNUPGHOME="$(mktemp -d)" \
32+
&& curl -fsSL ${SWIFT_WEBROOT}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \
33+
${SWIFT_WEBROOT}/${DOWNLOAD_DIR}/${download_signature} -o latest_toolchain.tar.gz.sig \
34+
&& curl -fSsL --compressed https://swift.org/keys/all-keys.asc | gpg --import - \
35+
&& gpg --batch --verify latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \
36+
# - Unpack the toolchain, set libs permissions, and clean up.
37+
&& yum -y install tar gzip \
38+
&& tar -xzf latest_toolchain.tar.gz --directory / --strip-components=1 \
39+
${DOWNLOAD_DIR}-${OS_VER}/usr/lib/swift/linux \
40+
${DOWNLOAD_DIR}-${OS_VER}/usr/libexec/swift/linux \
41+
&& chmod -R o+r /usr/lib/swift /usr/libexec/swift \
42+
&& rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \
43+
&& yum autoremove -y tar gzip
44+
45+
RUN echo "[ -n \"\${TERM:-}\" -a -r /etc/motd ] && cat /etc/motd" >> /etc/bashrc; \
46+
( \
47+
printf "################################################################\n"; \
48+
printf "# %-60s #\n" ""; \
49+
printf "# %-60s #\n" "Swift Nightly Docker Image"; \
50+
printf "# %-60s #\n" "Tag: $(cat .swift_tag)"; \
51+
printf "# %-60s #\n" ""; \
52+
printf "################################################################\n" \
53+
) > /etc/motd
54+
55+
RUN echo 'source /etc/bashrc' >> /root/.bashrc

nightly-6.3/debian/12/Dockerfile

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
FROM debian:12
2+
3+
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && apt-get -q update && \
4+
apt-get -q install -y \
5+
binutils-gold \
6+
curl \
7+
gpg \
8+
libicu-dev \
9+
libcurl4-openssl-dev \
10+
libedit-dev \
11+
libsqlite3-dev \
12+
libncurses-dev \
13+
libpython3-dev \
14+
libxml2-dev \
15+
pkg-config \
16+
uuid-dev \
17+
tzdata \
18+
git \
19+
gcc \
20+
libstdc++-12-dev \
21+
&& rm -r /var/lib/apt/lists/*
22+
23+
24+
ARG SWIFT_SIGNING_KEY=E813C892820A6FA13755B268F167DF1ACF9CE069
25+
ARG SWIFT_PLATFORM=debian12
26+
ARG SWIFT_VERSION=6.3
27+
ARG SWIFT_WEBROOT=https://download.swift.org/swift-6.3-branch
28+
ARG SWIFT_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM"
29+
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}
30+
31+
ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
32+
SWIFT_VERSION=$SWIFT_VERSION \
33+
SWIFT_WEBROOT=$SWIFT_WEBROOT \
34+
SWIFT_PREFIX=$SWIFT_PREFIX
35+
36+
RUN set -e; \
37+
ARCH_NAME="$(dpkg --print-architecture)"; \
38+
url=; \
39+
case "${ARCH_NAME##*-}" in \
40+
'amd64') \
41+
OS_ARCH_SUFFIX=''; \
42+
;; \
43+
'arm64') \
44+
OS_ARCH_SUFFIX='-aarch64'; \
45+
;; \
46+
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
47+
esac; \
48+
export $(curl -s ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \
49+
&& export $(curl -s ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \
50+
&& export DOWNLOAD_DIR=$(echo $download | sed "s/-${SWIFT_PLATFORM}${OS_ARCH_SUFFIX}.tar.gz//g") \
51+
&& echo $DOWNLOAD_DIR > .swift_tag \
52+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
53+
&& export GNUPGHOME="$(mktemp -d)" \
54+
&& curl -fsSL ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \
55+
${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz.sig \
56+
&& curl -fSsL --compressed https://swift.org/keys/all-keys.asc | gpg --import - \
57+
# - Unpack the toolchain, set libs permissions, and clean up.
58+
&& mkdir -p $SWIFT_PREFIX \
59+
&& tar -xzf latest_toolchain.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
60+
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
61+
&& rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz
62+
63+
ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
64+
65+
# Print Installed Swift Version
66+
RUN swift --version
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
FROM debian:12 as Base
2+
3+
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && apt-get -q update && \
4+
apt-get -q install -y \
5+
binutils-gold \
6+
curl \
7+
gpg \
8+
libicu-dev \
9+
libcurl4-openssl-dev \
10+
libedit-dev \
11+
libsqlite3-dev \
12+
libncurses-dev \
13+
libpython3-dev \
14+
libxml2-dev \
15+
pkg-config \
16+
uuid-dev \
17+
tzdata \
18+
git \
19+
gcc \
20+
libstdc++-12-dev \
21+
&& rm -r /var/lib/apt/lists/*
22+
23+
24+
ARG SWIFT_SIGNING_KEY=E813C892820A6FA13755B268F167DF1ACF9CE069
25+
ARG SWIFT_PLATFORM=debian12
26+
ARG SWIFT_VERSION=6.3
27+
ARG SWIFT_WEBROOT=https://download.swift.org/swift-6.3-branch
28+
ARG SWIFT_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM"
29+
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}
30+
31+
# This is a small trick to enable if/else for arm64 and amd64.
32+
# Because of https://bugs.swift.org/browse/SR-14872 we need adjust tar options.
33+
FROM base AS base-amd64
34+
ARG OS_ARCH_SUFFIX=
35+
36+
FROM base AS base-arm64
37+
ARG OS_ARCH_SUFFIX=-aarch64
38+
39+
FROM base-$TARGETARCH AS final
40+
41+
ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
42+
SWIFT_VERSION=$SWIFT_VERSION \
43+
SWIFT_WEBROOT=$SWIFT_WEBROOT \
44+
SWIFT_PREFIX=$SWIFT_PREFIX
45+
46+
RUN set -e; \
47+
ARCH_NAME="$(dpkg --print-architecture)"; \
48+
url=; \
49+
case "${ARCH_NAME##*-}" in \
50+
'amd64') \
51+
OS_ARCH_SUFFIX=''; \
52+
;; \
53+
'arm64') \
54+
OS_ARCH_SUFFIX='-aarch64'; \
55+
;; \
56+
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
57+
esac; \
58+
export $(curl -s ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \
59+
&& export $(curl -s ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \
60+
&& export DOWNLOAD_DIR=$(echo $download | sed "s/-${SWIFT_PLATFORM}${OS_ARCH_SUFFIX}.tar.gz//g") \
61+
&& echo $DOWNLOAD_DIR > .swift_tag \
62+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
63+
&& export GNUPGHOME="$(mktemp -d)" \
64+
&& curl -fsSL ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \
65+
${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz.sig \
66+
&& curl -fSsL --compressed https://swift.org/keys/all-keys.asc | gpg --import - \
67+
# - Unpack the toolchain, set libs permissions, and clean up.
68+
&& mkdir -p $SWIFT_PREFIX \
69+
&& tar -xzf latest_toolchain.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
70+
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
71+
&& rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz
72+
73+
ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
74+
75+
# Print Installed Swift Version
76+
RUN swift --version

0 commit comments

Comments
 (0)