From e1ba816ba351d31fed37ba394bd352916fe8bf2e Mon Sep 17 00:00:00 2001 From: taylorswift Date: Sun, 18 Feb 2024 05:16:35 +0000 Subject: [PATCH 1/4] amazon linux 2023 --- swift-ci/master/amazon-linux/2023/Dockerfile | 104 +++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 swift-ci/master/amazon-linux/2023/Dockerfile diff --git a/swift-ci/master/amazon-linux/2023/Dockerfile b/swift-ci/master/amazon-linux/2023/Dockerfile new file mode 100644 index 00000000..0ace08d6 --- /dev/null +++ b/swift-ci/master/amazon-linux/2023/Dockerfile @@ -0,0 +1,104 @@ +FROM amazonlinux:2023 + +RUN yum install shadow-utils -y + +RUN groupadd -g 998 build-user && \ + useradd -m -r -u 42 -g build-user build-user + +# The build needs a package from the EPEL repo so that needs to be enabled. +# https://www.tecmint.com/install-epel-repository-on-centos/ +# RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + +# Update and install needed build packages +RUN yum -y group install "development tools" +RUN yum -y install \ + cmake \ + curl-devel \ + gcc-c++ \ + git \ + glibc-static \ + libbsd-devel \ + libedit-devel \ + libicu-devel \ + libuuid-devel \ + libxml2-devel \ + ncurses-devel \ + pkgconfig \ + procps-ng \ + python \ + python-devel \ + python-pkgconfig \ + python-six \ + python3-devel \ + python3-psutil \ + rsync \ + sqlite-devel \ + swig \ + tzdata \ + unzip \ + uuid-devel \ + wget \ + which \ + zip + +# Additional dependencies specifically for Amazon Linux 2023 +RUN yum install -y \ + libmpc-devel \ + texinfo + +RUN git clone --depth 1 git://sourceware.org/git/binutils-gdb.git binutils +RUN mkdir binutils.build +RUN cd binutils.build \ + && ../binutils/configure --enable-gold --enable-plugins --disable-werror \ + && make all-gold \ + && mv gold/ld-new /usr/bin/ld.gold + +RUN dnf -y install dirmngr --allowerasing +RUN dnf swap gnupg2-minimal gnupg2-full + +ARG SWIFT_PLATFORM=amazonlinux2 +ARG SWIFT_VERSION=5.8.1 +ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release +ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE +ARG SWIFT_WEBROOT=https://download.swift.org +ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION} + +ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \ + SWIFT_VERSION=$SWIFT_VERSION \ + SWIFT_BRANCH=$SWIFT_BRANCH \ + SWIFT_TAG=$SWIFT_TAG \ + SWIFT_WEBROOT=$SWIFT_WEBROOT \ + SWIFT_PREFIX=$SWIFT_PREFIX + +RUN set -e; \ + ARCH_NAME="$(rpm --eval '%{_arch}')"; \ + url=; \ + case "${ARCH_NAME##*-}" in \ + 'x86_64') \ + OS_ARCH_SUFFIX=''; \ + ;; \ + 'aarch64') \ + OS_ARCH_SUFFIX='-aarch64'; \ + ;; \ + *) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \ + esac; \ + SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)$OS_ARCH_SUFFIX" \ + && SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_TAG/$SWIFT_TAG-$SWIFT_PLATFORM$OS_ARCH_SUFFIX.tar.gz" \ + && SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \ + && echo $SWIFT_BIN_URL \ + # - Download the GPG keys, Swift toolchain, and toolchain signature, and verify. + && export GNUPGHOME="$(mktemp -d)" \ + && curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \ + && curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \ + && gpg --batch --verify swift.tar.gz.sig swift.tar.gz \ + # - Unpack the toolchain, set libs permissions, and clean up. + && mkdir -p $SWIFT_PREFIX \ + && tar -xzf swift.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \ + && chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \ + && rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz + +ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}" + +USER build-user + +WORKDIR /home/build-user From ea9ae937a922c2727e1cff8974f430caef8e07c9 Mon Sep 17 00:00:00 2001 From: taylorswift Date: Sun, 18 Feb 2024 05:26:35 +0000 Subject: [PATCH 2/4] add speculative dockerfiles for 5.9, 5.10, and main --- 5.9/amazonlinux/2023/Dockerfile | 68 ++++++++++++++++ 5.9/amazonlinux/2023/slim/Dockerfile | 49 ++++++++++++ nightly-5.10/amazonlinux/2023/Dockerfile | 73 +++++++++++++++++ .../amazonlinux/2023/buildx/Dockerfile | 80 +++++++++++++++++++ nightly-5.10/amazonlinux/2023/slim/Dockerfile | 54 +++++++++++++ nightly-main/amazonlinux/2023/Dockerfile | 73 +++++++++++++++++ .../amazonlinux/2023/buildx/Dockerfile | 80 +++++++++++++++++++ nightly-main/amazonlinux/2023/slim/Dockerfile | 54 +++++++++++++ 8 files changed, 531 insertions(+) create mode 100644 5.9/amazonlinux/2023/Dockerfile create mode 100644 5.9/amazonlinux/2023/slim/Dockerfile create mode 100644 nightly-5.10/amazonlinux/2023/Dockerfile create mode 100644 nightly-5.10/amazonlinux/2023/buildx/Dockerfile create mode 100644 nightly-5.10/amazonlinux/2023/slim/Dockerfile create mode 100644 nightly-main/amazonlinux/2023/Dockerfile create mode 100644 nightly-main/amazonlinux/2023/buildx/Dockerfile create mode 100644 nightly-main/amazonlinux/2023/slim/Dockerfile diff --git a/5.9/amazonlinux/2023/Dockerfile b/5.9/amazonlinux/2023/Dockerfile new file mode 100644 index 00000000..d675c01e --- /dev/null +++ b/5.9/amazonlinux/2023/Dockerfile @@ -0,0 +1,68 @@ +FROM amazonlinux:2023 +LABEL maintainer="Swift Infrastructure " +LABEL description="Docker Container for the Swift programming language" + +RUN yum -y install \ + binutils \ + gcc \ + git \ + unzip \ + glibc-static \ + gzip \ + libbsd \ + libcurl-devel \ + libedit \ + libicu \ + libsqlite \ + libstdc++-static \ + libuuid \ + libxml2-devel \ + tar \ + tzdata \ + zlib-devel + +# Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little + +# pub 4096R/ED3D1561 2019-03-22 [SC] [expires: 2023-03-23] +# Key fingerprint = A62A E125 BBBF BB96 A6E0 42EC 925C C1CC ED3D 1561 +# uid Swift 5.x Release Signing Key &2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \ + esac; \ + SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)$OS_ARCH_SUFFIX" \ + && SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_VERSION/$SWIFT_VERSION-$SWIFT_PLATFORM$OS_ARCH_SUFFIX.tar.gz" \ + && SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \ + && echo $SWIFT_BIN_URL \ + # - Download the GPG keys, Swift toolchain, and toolchain signature, and verify. + && export GNUPGHOME="$(mktemp -d)" \ + && curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \ + && gpg --batch --quiet --keyserver keyserver.ubuntu.com --recv-keys "$SWIFT_SIGNING_KEY" \ + && gpg --batch --verify swift.tar.gz.sig swift.tar.gz \ + # - Unpack the toolchain, set libs permissions, and clean up. + && tar -xzf swift.tar.gz --directory / --strip-components=1 \ + && chmod -R o+r /usr/lib/swift \ + && rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz + +# Print Installed Swift Version +RUN swift --version diff --git a/5.9/amazonlinux/2023/slim/Dockerfile b/5.9/amazonlinux/2023/slim/Dockerfile new file mode 100644 index 00000000..2254e71d --- /dev/null +++ b/5.9/amazonlinux/2023/slim/Dockerfile @@ -0,0 +1,49 @@ +FROM amazonlinux:2023 +LABEL maintainer="Swift Infrastructure " +LABEL description="Docker Container for the Swift programming language" + +# Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little + +# pub 4096R/ED3D1561 2019-03-22 [SC] [expires: 2023-03-23] +# Key fingerprint = A62A E125 BBBF BB96 A6E0 42EC 925C C1CC ED3D 1561 +# uid Swift 5.x Release Signing Key &2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \ + esac; \ + SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)$OS_ARCH_SUFFIX" \ + && SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_VERSION/$SWIFT_VERSION-$SWIFT_PLATFORM$OS_ARCH_SUFFIX.tar.gz" \ + && SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \ + # - Download the GPG keys, Swift toolchain, and toolchain signature, and verify. + && export GNUPGHOME="$(mktemp -d)" \ + && curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \ + && gpg --batch --quiet --keyserver keyserver.ubuntu.com --recv-keys "$SWIFT_SIGNING_KEY" \ + && gpg --batch --verify swift.tar.gz.sig swift.tar.gz \ + # - Unpack the toolchain, set libs permissions, and clean up. + && yum -y install tar gzip \ + && tar -xzf swift.tar.gz --directory / --strip-components=1 \ + $SWIFT_VERSION-$SWIFT_PLATFORM$OS_ARCH_SUFFIX/usr/lib/swift/linux \ + $SWIFT_VERSION-$SWIFT_PLATFORM$OS_ARCH_SUFFIX/usr/libexec/swift/linux \ + && chmod -R o+r /usr/lib/swift /usr/libexec/swift \ + && rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz \ + && yum autoremove -y tar gzip diff --git a/nightly-5.10/amazonlinux/2023/Dockerfile b/nightly-5.10/amazonlinux/2023/Dockerfile new file mode 100644 index 00000000..85168aaf --- /dev/null +++ b/nightly-5.10/amazonlinux/2023/Dockerfile @@ -0,0 +1,73 @@ +FROM amazonlinux:2023 +LABEL maintainer="Swift Infrastructure " +LABEL description="Docker Container for the Swift programming language" + +RUN yum -y install \ + binutils \ + gcc \ + git \ + glibc-static \ + gzip \ + libbsd \ + libcurl-devel \ + libedit \ + libicu \ + libsqlite \ + libstdc++-static \ + libuuid \ + libxml2-devel \ + tar \ + tzdata \ + unzip \ + zip \ + zlib-devel + +# Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little + +# gpg --keyid-format LONG -k FAF6989E1BC16FEA +# pub rsa4096/FAF6989E1BC16FEA 2019-11-07 [SC] [expires: 2021-11-06] +# 8A7495662C3CD4AE18D95637FAF6989E1BC16FEA +# uid [ unknown] Swift Automatic Signing Key #3 +ARG SWIFT_SIGNING_KEY=8A7495662C3CD4AE18D95637FAF6989E1BC16FEA +ARG SWIFT_PLATFORM=amazonlinux +ARG OS_MAJOR_VER=2023 +ARG SWIFT_WEBROOT=https://download.swift.org/swift-5.10-branch + +ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \ + SWIFT_PLATFORM=$SWIFT_PLATFORM \ + OS_MAJOR_VER=$OS_MAJOR_VER \ + OS_VER=$SWIFT_PLATFORM$OS_MAJOR_VER \ + SWIFT_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM$OS_MAJOR_VER" + +RUN echo "${SWIFT_WEBROOT}/latest-build.yml" + +RUN set -e; \ + # - Latest Toolchain info + export $(curl -s ${SWIFT_WEBROOT}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \ + && export $(curl -s ${SWIFT_WEBROOT}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \ + && export DOWNLOAD_DIR=$(echo $download | sed "s/-${OS_VER}.tar.gz//g") \ + && echo $DOWNLOAD_DIR > .swift_tag \ + # - Download the GPG keys, Swift toolchain, and toolchain signature, and verify. + && export GNUPGHOME="$(mktemp -d)" \ + && curl -fsSL ${SWIFT_WEBROOT}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \ + ${SWIFT_WEBROOT}/${DOWNLOAD_DIR}/${download_signature} -o latest_toolchain.tar.gz.sig \ + && curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \ + && gpg --batch --verify latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \ + # - Unpack the toolchain, set libs permissions, and clean up. + && tar -xzf latest_toolchain.tar.gz --directory / --strip-components=1 \ + && chmod -R o+r /usr/lib/swift \ + && rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz + +# Print Installed Swift Version +RUN swift --version + +RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \ + >> /etc/bashrc; \ + echo -e " ################################################################\n" \ + "#\t\t\t\t\t\t\t\t#\n" \ + "# Swift Nightly Docker Image\t\t\t\t\t#\n" \ + "# Tag: $(cat .swift_tag)\t\t\t#\n" \ + "#\t\t\t\t\t\t\t\t#\n" \ + "################################################################\n" > /etc/motd + +RUN echo 'source /etc/bashrc' >> /root/.bashrc diff --git a/nightly-5.10/amazonlinux/2023/buildx/Dockerfile b/nightly-5.10/amazonlinux/2023/buildx/Dockerfile new file mode 100644 index 00000000..53759fab --- /dev/null +++ b/nightly-5.10/amazonlinux/2023/buildx/Dockerfile @@ -0,0 +1,80 @@ +FROM amazonlinux:2023 AS base +LABEL maintainer="Swift Infrastructure " +LABEL description="Docker Container for the Swift programming language" + +RUN yum -y install \ + binutils \ + gcc \ + git \ + glibc-static \ + gzip \ + libbsd \ + libcurl-devel \ + libedit \ + libicu \ + libsqlite \ + libstdc++-static \ + libuuid \ + libxml2-devel \ + tar \ + tzdata \ + unzip \ + zip \ + zlib-devel + +# Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little + +# gpg --keyid-format LONG -k FAF6989E1BC16FEA +# pub rsa4096/FAF6989E1BC16FEA 2019-11-07 [SC] [expires: 2021-11-06] +# 8A7495662C3CD4AE18D95637FAF6989E1BC16FEA +# uid [ unknown] Swift Automatic Signing Key #3 +ARG SWIFT_SIGNING_KEY=8A7495662C3CD4AE18D95637FAF6989E1BC16FEA +ARG SWIFT_PLATFORM=amazonlinux +ARG OS_MAJOR_VER=2023 +ARG SWIFT_WEBROOT=https://download.swift.org/swift-5.10-branch + +# This is a small trick to enable if/else for arm64 and amd64. +# Because of https://bugs.swift.org/browse/SR-14872 we need adjust tar options. +FROM base AS base-amd64 +ARG OS_ARCH_SUFFIX= + +FROM base AS base-arm64 +ARG OS_ARCH_SUFFIX=-aarch64 + +FROM base-$TARGETARCH AS final + +ARG OS_VER=$SWIFT_PLATFORM$OS_MAJOR_VER$OS_ARCH_SUFFIX +ARG PLATFORM_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM$OS_MAJOR_VER$OS_ARCH_SUFFIX" + +RUN echo "${PLATFORM_WEBROOT}/latest-build.yml" + +RUN set -e; \ + # - Latest Toolchain info + export $(curl -s ${PLATFORM_WEBROOT}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \ + && export $(curl -s ${PLATFORM_WEBROOT}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \ + && export DOWNLOAD_DIR=$(echo $download | sed "s/-${OS_VER}.tar.gz//g") \ + && echo $DOWNLOAD_DIR > .swift_tag \ + # - Download the GPG keys, Swift toolchain, and toolchain signature, and verify. + && export GNUPGHOME="$(mktemp -d)" \ + && curl -fsSL ${PLATFORM_WEBROOT}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \ + ${PLATFORM_WEBROOT}/${DOWNLOAD_DIR}/${download_signature} -o latest_toolchain.tar.gz.sig \ + && curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \ + && gpg --batch --verify latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \ + # - Unpack the toolchain, set libs permissions, and clean up. + && tar -xzf latest_toolchain.tar.gz --directory / --strip-components=1 \ + && chmod -R o+r /usr/lib/swift \ + && rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz + +# Print Installed Swift Version +RUN swift --version + +RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \ + >> /etc/bashrc; \ + echo -e " ################################################################\n" \ + "#\t\t\t\t\t\t\t\t#\n" \ + "# Swift Nightly Docker Image\t\t\t\t\t#\n" \ + "# Tag: $(cat .swift_tag)\t\t\t#\n" \ + "#\t\t\t\t\t\t\t\t#\n" \ + "################################################################\n" > /etc/motd + +RUN echo 'source /etc/bashrc' >> /root/.bashrc diff --git a/nightly-5.10/amazonlinux/2023/slim/Dockerfile b/nightly-5.10/amazonlinux/2023/slim/Dockerfile new file mode 100644 index 00000000..840a4734 --- /dev/null +++ b/nightly-5.10/amazonlinux/2023/slim/Dockerfile @@ -0,0 +1,54 @@ +FROM amazonlinux:2023 +LABEL maintainer="Swift Infrastructure " +LABEL description="Docker Container for the Swift programming language" + +# Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little + +# gpg --keyid-format LONG -k FAF6989E1BC16FEA +# pub rsa4096/FAF6989E1BC16FEA 2019-11-07 [SC] [expires: 2021-11-06] +# 8A7495662C3CD4AE18D95637FAF6989E1BC16FEA +# uid [ unknown] Swift Automatic Signing Key #3 +ARG SWIFT_SIGNING_KEY=8A7495662C3CD4AE18D95637FAF6989E1BC16FEA +ARG SWIFT_PLATFORM=amazonlinux +ARG OS_MAJOR_VER=2023 +ARG SWIFT_WEBROOT=https://download.swift.org/swift-5.10-branch + +ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \ + SWIFT_PLATFORM=$SWIFT_PLATFORM \ + OS_MAJOR_VER=$OS_MAJOR_VER \ + OS_VER=$SWIFT_PLATFORM$OS_MAJOR_VER \ + SWIFT_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM$OS_MAJOR_VER" + +RUN echo "${SWIFT_WEBROOT}/latest-build.yml" + +RUN set -e; \ + # - Latest Toolchain info + export $(curl -s ${SWIFT_WEBROOT}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \ + && export $(curl -s ${SWIFT_WEBROOT}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \ + && export DOWNLOAD_DIR=$(echo $download | sed "s/-${OS_VER}.tar.gz//g") \ + && echo $DOWNLOAD_DIR > .swift_tag \ + # - Download the GPG keys, Swift toolchain, and toolchain signature, and verify. + && export GNUPGHOME="$(mktemp -d)" \ + && curl -fsSL ${SWIFT_WEBROOT}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \ + ${SWIFT_WEBROOT}/${DOWNLOAD_DIR}/${download_signature} -o latest_toolchain.tar.gz.sig \ + && curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \ + && gpg --batch --verify latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \ + # - Unpack the toolchain, set libs permissions, and clean up. + && yum -y install tar gzip \ + && tar -xzf latest_toolchain.tar.gz --directory / --strip-components=1 \ + ${DOWNLOAD_DIR}-${OS_VER}/usr/lib/swift/linux \ + ${DOWNLOAD_DIR}-${OS_VER}/usr/libexec/swift/linux \ + && chmod -R o+r /usr/lib/swift /usr/libexec/swift \ + && rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \ + && yum autoremove -y tar gzip + +RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \ + >> /etc/bashrc; \ + echo -e " ################################################################\n" \ + "#\t\t\t\t\t\t\t\t#\n" \ + "# Swift Nightly Docker Image\t\t\t\t\t#\n" \ + "# Tag: $(cat .swift_tag)\t\t\t#\n" \ + "#\t\t\t\t\t\t\t\t#\n" \ + "################################################################\n" > /etc/motd + +RUN echo 'source /etc/bashrc' >> /root/.bashrc diff --git a/nightly-main/amazonlinux/2023/Dockerfile b/nightly-main/amazonlinux/2023/Dockerfile new file mode 100644 index 00000000..ed9e0650 --- /dev/null +++ b/nightly-main/amazonlinux/2023/Dockerfile @@ -0,0 +1,73 @@ +FROM amazonlinux:2023 +LABEL maintainer="Swift Infrastructure " +LABEL description="Docker Container for the Swift programming language" + +RUN yum -y install \ + binutils \ + gcc \ + git \ + glibc-static \ + gzip \ + libbsd \ + libcurl-devel \ + libedit \ + libicu \ + libsqlite \ + libstdc++-static \ + libuuid \ + libxml2-devel \ + tar \ + tzdata \ + unzip \ + zip \ + zlib-devel + +# Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little + +# gpg --keyid-format LONG -k FAF6989E1BC16FEA +# pub rsa4096/FAF6989E1BC16FEA 2019-11-07 [SC] [expires: 2021-11-06] +# 8A7495662C3CD4AE18D95637FAF6989E1BC16FEA +# uid [ unknown] Swift Automatic Signing Key #3 +ARG SWIFT_SIGNING_KEY=8A7495662C3CD4AE18D95637FAF6989E1BC16FEA +ARG SWIFT_PLATFORM=amazonlinux +ARG OS_MAJOR_VER=2023 +ARG SWIFT_WEBROOT=https://download.swift.org/development + +ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \ + SWIFT_PLATFORM=$SWIFT_PLATFORM \ + OS_MAJOR_VER=$OS_MAJOR_VER \ + OS_VER=$SWIFT_PLATFORM$OS_MAJOR_VER \ + SWIFT_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM$OS_MAJOR_VER" + +RUN echo "${SWIFT_WEBROOT}/latest-build.yml" + +RUN set -e; \ + # - Latest Toolchain info + export $(curl -s ${SWIFT_WEBROOT}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \ + && export $(curl -s ${SWIFT_WEBROOT}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \ + && export DOWNLOAD_DIR=$(echo $download | sed "s/-${OS_VER}.tar.gz//g") \ + && echo $DOWNLOAD_DIR > .swift_tag \ + # - Download the GPG keys, Swift toolchain, and toolchain signature, and verify. + && export GNUPGHOME="$(mktemp -d)" \ + && curl -fsSL ${SWIFT_WEBROOT}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \ + ${SWIFT_WEBROOT}/${DOWNLOAD_DIR}/${download_signature} -o latest_toolchain.tar.gz.sig \ + && curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \ + && gpg --batch --verify latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \ + # - Unpack the toolchain, set libs permissions, and clean up. + && tar -xzf latest_toolchain.tar.gz --directory / --strip-components=1 \ + && chmod -R o+r /usr/lib/swift \ + && rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz + +# Print Installed Swift Version +RUN swift --version + +RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \ + >> /etc/bashrc; \ + echo -e " ################################################################\n" \ + "#\t\t\t\t\t\t\t\t#\n" \ + "# Swift Nightly Docker Image\t\t\t\t\t#\n" \ + "# Tag: $(cat .swift_tag)\t\t\t#\n" \ + "#\t\t\t\t\t\t\t\t#\n" \ + "################################################################\n" > /etc/motd + +RUN echo 'source /etc/bashrc' >> /root/.bashrc diff --git a/nightly-main/amazonlinux/2023/buildx/Dockerfile b/nightly-main/amazonlinux/2023/buildx/Dockerfile new file mode 100644 index 00000000..e697d6d4 --- /dev/null +++ b/nightly-main/amazonlinux/2023/buildx/Dockerfile @@ -0,0 +1,80 @@ +FROM amazonlinux:2023 AS base +LABEL maintainer="Swift Infrastructure " +LABEL description="Docker Container for the Swift programming language" + +RUN yum -y install \ + binutils \ + gcc \ + git \ + glibc-static \ + gzip \ + libbsd \ + libcurl-devel \ + libedit \ + libicu \ + libsqlite \ + libstdc++-static \ + libuuid \ + libxml2-devel \ + tar \ + tzdata \ + unzip \ + zip \ + zlib-devel + +# Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little + +# gpg --keyid-format LONG -k FAF6989E1BC16FEA +# pub rsa4096/FAF6989E1BC16FEA 2019-11-07 [SC] [expires: 2021-11-06] +# 8A7495662C3CD4AE18D95637FAF6989E1BC16FEA +# uid [ unknown] Swift Automatic Signing Key #3 +ARG SWIFT_SIGNING_KEY=8A7495662C3CD4AE18D95637FAF6989E1BC16FEA +ARG SWIFT_PLATFORM=amazonlinux +ARG OS_MAJOR_VER=2023 +ARG SWIFT_WEBROOT=https://download.swift.org/development + +# This is a small trick to enable if/else for arm64 and amd64. +# Because of https://bugs.swift.org/browse/SR-14872 we need adjust tar options. +FROM base AS base-amd64 +ARG OS_ARCH_SUFFIX= + +FROM base AS base-arm64 +ARG OS_ARCH_SUFFIX=-aarch64 + +FROM base-$TARGETARCH AS final + +ARG OS_VER=$SWIFT_PLATFORM$OS_MAJOR_VER$OS_ARCH_SUFFIX +ARG PLATFORM_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM$OS_MAJOR_VER$OS_ARCH_SUFFIX" + +RUN echo "${PLATFORM_WEBROOT}/latest-build.yml" + +RUN set -e; \ + # - Latest Toolchain info + export $(curl -s ${PLATFORM_WEBROOT}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \ + && export $(curl -s ${PLATFORM_WEBROOT}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \ + && export DOWNLOAD_DIR=$(echo $download | sed "s/-${OS_VER}.tar.gz//g") \ + && echo $DOWNLOAD_DIR > .swift_tag \ + # - Download the GPG keys, Swift toolchain, and toolchain signature, and verify. + && export GNUPGHOME="$(mktemp -d)" \ + && curl -fsSL ${PLATFORM_WEBROOT}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \ + ${PLATFORM_WEBROOT}/${DOWNLOAD_DIR}/${download_signature} -o latest_toolchain.tar.gz.sig \ + && curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \ + && gpg --batch --verify latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \ + # - Unpack the toolchain, set libs permissions, and clean up. + && tar -xzf latest_toolchain.tar.gz --directory / --strip-components=1 \ + && chmod -R o+r /usr/lib/swift \ + && rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz + +# Print Installed Swift Version +RUN swift --version + +RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \ + >> /etc/bashrc; \ + echo -e " ################################################################\n" \ + "#\t\t\t\t\t\t\t\t#\n" \ + "# Swift Nightly Docker Image\t\t\t\t\t#\n" \ + "# Tag: $(cat .swift_tag)\t\t\t#\n" \ + "#\t\t\t\t\t\t\t\t#\n" \ + "################################################################\n" > /etc/motd + +RUN echo 'source /etc/bashrc' >> /root/.bashrc diff --git a/nightly-main/amazonlinux/2023/slim/Dockerfile b/nightly-main/amazonlinux/2023/slim/Dockerfile new file mode 100644 index 00000000..92d2c3c4 --- /dev/null +++ b/nightly-main/amazonlinux/2023/slim/Dockerfile @@ -0,0 +1,54 @@ +FROM amazonlinux:2023 +LABEL maintainer="Swift Infrastructure " +LABEL description="Docker Container for the Swift programming language" + +# Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little + +# gpg --keyid-format LONG -k FAF6989E1BC16FEA +# pub rsa4096/FAF6989E1BC16FEA 2019-11-07 [SC] [expires: 2021-11-06] +# 8A7495662C3CD4AE18D95637FAF6989E1BC16FEA +# uid [ unknown] Swift Automatic Signing Key #3 +ARG SWIFT_SIGNING_KEY=8A7495662C3CD4AE18D95637FAF6989E1BC16FEA +ARG SWIFT_PLATFORM=amazonlinux +ARG OS_MAJOR_VER=2023 +ARG SWIFT_WEBROOT=https://download.swift.org/development + +ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \ + SWIFT_PLATFORM=$SWIFT_PLATFORM \ + OS_MAJOR_VER=$OS_MAJOR_VER \ + OS_VER=$SWIFT_PLATFORM$OS_MAJOR_VER \ + SWIFT_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM$OS_MAJOR_VER" + +RUN echo "${SWIFT_WEBROOT}/latest-build.yml" + +RUN set -e; \ + # - Latest Toolchain info + export $(curl -s ${SWIFT_WEBROOT}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \ + && export $(curl -s ${SWIFT_WEBROOT}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \ + && export DOWNLOAD_DIR=$(echo $download | sed "s/-${OS_VER}.tar.gz//g") \ + && echo $DOWNLOAD_DIR > .swift_tag \ + # - Download the GPG keys, Swift toolchain, and toolchain signature, and verify. + && export GNUPGHOME="$(mktemp -d)" \ + && curl -fsSL ${SWIFT_WEBROOT}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \ + ${SWIFT_WEBROOT}/${DOWNLOAD_DIR}/${download_signature} -o latest_toolchain.tar.gz.sig \ + && curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \ + && gpg --batch --verify latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \ + # - Unpack the toolchain, set libs permissions, and clean up. + && yum -y install tar gzip \ + && tar -xzf latest_toolchain.tar.gz --directory / --strip-components=1 \ + ${DOWNLOAD_DIR}-${OS_VER}/usr/lib/swift/linux \ + ${DOWNLOAD_DIR}-${OS_VER}/usr/libexec/swift/linux \ + && chmod -R o+r /usr/lib/swift /usr/libexec/swift \ + && rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \ + && yum autoremove -y tar gzip + +RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \ + >> /etc/bashrc; \ + echo -e " ################################################################\n" \ + "#\t\t\t\t\t\t\t\t#\n" \ + "# Swift Nightly Docker Image\t\t\t\t\t#\n" \ + "# Tag: $(cat .swift_tag)\t\t\t#\n" \ + "#\t\t\t\t\t\t\t\t#\n" \ + "################################################################\n" > /etc/motd + +RUN echo 'source /etc/bashrc' >> /root/.bashrc From e3a858758080b067803763c8b30dd504f9555860 Mon Sep 17 00:00:00 2001 From: taylorswift Date: Sun, 18 Feb 2024 20:28:55 +0000 Subject: [PATCH 3/4] replace yum with dnf --- swift-ci/master/amazon-linux/2023/Dockerfile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/swift-ci/master/amazon-linux/2023/Dockerfile b/swift-ci/master/amazon-linux/2023/Dockerfile index 0ace08d6..0df259e5 100644 --- a/swift-ci/master/amazon-linux/2023/Dockerfile +++ b/swift-ci/master/amazon-linux/2023/Dockerfile @@ -1,17 +1,13 @@ FROM amazonlinux:2023 -RUN yum install shadow-utils -y +RUN dnf install shadow-utils -y RUN groupadd -g 998 build-user && \ useradd -m -r -u 42 -g build-user build-user -# The build needs a package from the EPEL repo so that needs to be enabled. -# https://www.tecmint.com/install-epel-repository-on-centos/ -# RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - # Update and install needed build packages -RUN yum -y group install "development tools" -RUN yum -y install \ +RUN dnf -y group install "development tools" +RUN dnf -y install \ cmake \ curl-devel \ gcc-c++ \ @@ -42,7 +38,7 @@ RUN yum -y install \ zip # Additional dependencies specifically for Amazon Linux 2023 -RUN yum install -y \ +RUN dnf install -y \ libmpc-devel \ texinfo From 149329d17fef2d72747404747eb44ee257da162b Mon Sep 17 00:00:00 2001 From: taylorswift Date: Sun, 18 Feb 2024 22:27:36 +0000 Subject: [PATCH 4/4] this is the way --- 5.9/amazonlinux/2023/Dockerfile | 2 ++ nightly-5.10/amazonlinux/2023/Dockerfile | 2 ++ nightly-5.10/amazonlinux/2023/buildx/Dockerfile | 2 ++ nightly-main/amazonlinux/2023/Dockerfile | 2 ++ nightly-main/amazonlinux/2023/buildx/Dockerfile | 2 ++ 5 files changed, 10 insertions(+) diff --git a/5.9/amazonlinux/2023/Dockerfile b/5.9/amazonlinux/2023/Dockerfile index d675c01e..dcd08b16 100644 --- a/5.9/amazonlinux/2023/Dockerfile +++ b/5.9/amazonlinux/2023/Dockerfile @@ -21,6 +21,8 @@ RUN yum -y install \ tzdata \ zlib-devel +RUN ln -s /bin/ld /usr/bin/ld.gold + # Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little # pub 4096R/ED3D1561 2019-03-22 [SC] [expires: 2023-03-23] diff --git a/nightly-5.10/amazonlinux/2023/Dockerfile b/nightly-5.10/amazonlinux/2023/Dockerfile index 85168aaf..768afbba 100644 --- a/nightly-5.10/amazonlinux/2023/Dockerfile +++ b/nightly-5.10/amazonlinux/2023/Dockerfile @@ -22,6 +22,8 @@ RUN yum -y install \ zip \ zlib-devel +RUN ln -s /bin/ld /usr/bin/ld.gold + # Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little # gpg --keyid-format LONG -k FAF6989E1BC16FEA diff --git a/nightly-5.10/amazonlinux/2023/buildx/Dockerfile b/nightly-5.10/amazonlinux/2023/buildx/Dockerfile index 53759fab..daeaafcb 100644 --- a/nightly-5.10/amazonlinux/2023/buildx/Dockerfile +++ b/nightly-5.10/amazonlinux/2023/buildx/Dockerfile @@ -22,6 +22,8 @@ RUN yum -y install \ zip \ zlib-devel +RUN ln -s /bin/ld /usr/bin/ld.gold + # Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little # gpg --keyid-format LONG -k FAF6989E1BC16FEA diff --git a/nightly-main/amazonlinux/2023/Dockerfile b/nightly-main/amazonlinux/2023/Dockerfile index ed9e0650..a072a5ae 100644 --- a/nightly-main/amazonlinux/2023/Dockerfile +++ b/nightly-main/amazonlinux/2023/Dockerfile @@ -22,6 +22,8 @@ RUN yum -y install \ zip \ zlib-devel +RUN ln -s /bin/ld /usr/bin/ld.gold + # Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little # gpg --keyid-format LONG -k FAF6989E1BC16FEA diff --git a/nightly-main/amazonlinux/2023/buildx/Dockerfile b/nightly-main/amazonlinux/2023/buildx/Dockerfile index e697d6d4..88a0a793 100644 --- a/nightly-main/amazonlinux/2023/buildx/Dockerfile +++ b/nightly-main/amazonlinux/2023/buildx/Dockerfile @@ -22,6 +22,8 @@ RUN yum -y install \ zip \ zlib-devel +RUN ln -s /bin/ld /usr/bin/ld.gold + # Everything up to here should cache nicely between Swift versions, assuming dev dependencies change little # gpg --keyid-format LONG -k FAF6989E1BC16FEA