Skip to content

Commit 1cd5ff3

Browse files
add fedora 41 dockerfiles
1 parent f7d556f commit 1cd5ff3

2 files changed

Lines changed: 143 additions & 0 deletions

File tree

nightly-main/fedora/41/Dockerfile

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
FROM fedora:41
2+
LABEL maintainer="Swift Infrastructure <swift-infrastructure@forums.swift.org>"
3+
LABEL description="Docker Container for the Swift programming language"
4+
5+
RUN yum -y install \
6+
binutils \
7+
gcc \
8+
git \
9+
gnupg2 \
10+
zip \
11+
unzip \
12+
curl \
13+
libcurl-devel \
14+
libedit-devel \
15+
libicu-devel \
16+
sqlite-devel \
17+
libuuid-devel \
18+
libxml2-devel \
19+
python3-devel \
20+
libstdc++-devel \
21+
libstdc++-static
22+
23+
ARG SWIFT_SIGNING_KEY=E813C892820A6FA13755B268F167DF1ACF9CE069
24+
ARG SWIFT_PLATFORM=fedora41
25+
ARG SWIFT_WEBROOT=https://download.swift.org/development
26+
ARG SWIFT_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM"
27+
28+
ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \
29+
SWIFT_PLATFORM=$SWIFT_PLATFORM \
30+
SWIFT_WEBROOT=$SWIFT_WEBROOT
31+
32+
RUN echo "${SWIFT_WEBROOT}/latest-build.yml"
33+
34+
RUN set -e; \
35+
ARCH_NAME="$(rpm --eval '%{_arch}')"; \
36+
case "${ARCH_NAME##*-}" in \
37+
'x86_64') \
38+
OS_ARCH_SUFFIX=''; \
39+
;; \
40+
'aarch64') \
41+
OS_ARCH_SUFFIX='-aarch64'; \
42+
;; \
43+
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
44+
esac; \
45+
export $(curl -s ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \
46+
&& export $(curl -s ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \
47+
&& export DOWNLOAD_DIR=$(echo $download | sed "s/-${SWIFT_PLATFORM}${OS_ARCH_SUFFIX}.tar.gz//g") \
48+
&& echo $DOWNLOAD_DIR > .swift_tag \
49+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
50+
&& export GNUPGHOME="$(mktemp -d)" \
51+
&& curl -fsSL ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \
52+
${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/${DOWNLOAD_DIR}/${download_signature} -o latest_toolchain.tar.gz.sig \
53+
&& curl -fSsL --compressed https://swift.org/keys/all-keys.asc | gpg --import - \
54+
&& gpg --batch --verify latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \
55+
# - Unpack the toolchain, set libs permissions, and clean up.
56+
&& tar -xzf latest_toolchain.tar.gz --directory / --strip-components=1 \
57+
&& chmod -R o+r /usr/lib/swift \
58+
&& rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz
59+
60+
# Print Installed Swift Version
61+
RUN swift --version
62+
63+
RUN echo "[ -n \"\${TERM:-}\" -a -r /etc/motd ] && cat /etc/motd" >> /etc/bashrc; \
64+
( \
65+
printf "################################################################\n"; \
66+
printf "# %-60s #\n" ""; \
67+
printf "# %-60s #\n" "Swift Nightly Docker Image"; \
68+
printf "# %-60s #\n" "Tag: $(cat .swift_tag)"; \
69+
printf "# %-60s #\n" ""; \
70+
printf "################################################################\n" \
71+
) > /etc/motd
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
FROM fedora:41 AS base
2+
LABEL maintainer="Swift Infrastructure <swift-infrastructure@forums.swift.org>"
3+
LABEL description="Docker Container for the Swift programming language"
4+
5+
RUN yum -y install \
6+
binutils \
7+
gcc \
8+
git \
9+
gnupg2 \
10+
zip \
11+
unzip \
12+
curl \
13+
libcurl-devel \
14+
libedit-devel \
15+
libicu-devel \
16+
sqlite-devel \
17+
libuuid-devel \
18+
libxml2-devel \
19+
python3-devel \
20+
libstdc++-devel \
21+
libstdc++-static
22+
23+
ARG SWIFT_SIGNING_KEY=E813C892820A6FA13755B268F167DF1ACF9CE069
24+
ARG SWIFT_PLATFORM=fedora41
25+
ARG SWIFT_WEBROOT=https://download.swift.org/development
26+
27+
# This is a small trick to enable if/else for arm64 and amd64.
28+
# Because of https://bugs.swift.org/browse/SR-14872 we need adjust tar options.
29+
FROM base AS base-amd64
30+
ARG OS_ARCH_SUFFIX=
31+
32+
FROM base AS base-arm64
33+
ARG OS_ARCH_SUFFIX=-aarch64
34+
35+
FROM base-$TARGETARCH AS final
36+
37+
ARG PLATFORM_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM$OS_ARCH_SUFFIX"
38+
39+
ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \
40+
SWIFT_PLATFORM=$SWIFT_PLATFORM \
41+
SWIFT_WEBROOT=$SWIFT_WEBROOT
42+
43+
RUN echo "${PLATFORM_WEBROOT}/latest-build.yml"
44+
45+
RUN set -e; \
46+
export $(curl -s ${PLATFORM_WEBROOT}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \
47+
&& export $(curl -s ${PLATFORM_WEBROOT}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \
48+
&& export DOWNLOAD_DIR=$(echo $download | sed "s/-${SWIFT_PLATFORM}${OS_ARCH_SUFFIX}.tar.gz//g") \
49+
&& echo $DOWNLOAD_DIR > .swift_tag \
50+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
51+
&& export GNUPGHOME="$(mktemp -d)" \
52+
&& curl -fsSL ${PLATFORM_WEBROOT}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \
53+
${PLATFORM_WEBROOT}/${DOWNLOAD_DIR}/${download_signature} -o latest_toolchain.tar.gz.sig \
54+
&& curl -fSsL --compressed https://swift.org/keys/all-keys.asc | gpg --import - \
55+
&& gpg --batch --verify latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \
56+
# - Unpack the toolchain, set libs permissions, and clean up.
57+
&& tar -xzf latest_toolchain.tar.gz --directory / --strip-components=1 \
58+
&& chmod -R o+r /usr/lib/swift \
59+
&& rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz
60+
61+
# Print Installed Swift Version
62+
RUN swift --version
63+
64+
RUN echo "[ -n \"\${TERM:-}\" -a -r /etc/motd ] && cat /etc/motd" >> /etc/bashrc; \
65+
( \
66+
printf "################################################################\n"; \
67+
printf "# %-60s #\n" ""; \
68+
printf "# %-60s #\n" "Swift Nightly Docker Image"; \
69+
printf "# %-60s #\n" "Tag: $(cat .swift_tag)"; \
70+
printf "# %-60s #\n" ""; \
71+
printf "################################################################\n" \
72+
) > /etc/motd

0 commit comments

Comments
 (0)