Skip to content

Commit 6fb5fdf

Browse files
committed
Add ubi9 buildx config
1 parent 3a10612 commit 6fb5fdf

File tree

1 file changed

+74
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)