Minimum requirements for installing a swift toolchain?

i’ve been cargo-culting this dependency stack in my dockerfiles for a while now:

FROM amazonlinux:latest
WORKDIR /home/ec2-user/

RUN yum -y update 
RUN yum -y install lsb-release curl git cmake ninja-build clang python \
    uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev \
    libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config tar

ENV SWIFTENV_ROOT /home/ec2-user/.swiftenv
RUN mkdir -p $SWIFTENV_ROOT
ADD https://github.com/kylef/swiftenv/archive/1.2.0.tar.gz /tmp/swiftenv.tar.gz
RUN tar -xzf /tmp/swiftenv.tar.gz -C $SWIFTENV_ROOT --strip 1

ENV PATH $SWIFTENV_ROOT/bin:$SWIFTENV_ROOT/shims:$PATH
ENV SWIFT_VERSION DEVELOPMENT-SNAPSHOT-2022-08-01-a
RUN swiftenv install https://download.swift.org/development/amazonlinux2/swift-$SWIFT_VERSION/swift-$SWIFT_VERSION-amazonlinux2.tar.gz
RUN swiftenv global $SWIFT_VERSION

i’ve suspected most of these dependencies aren’t actually necessary to get a swift environment going. (i am not building the compiler from inside the container)

what is the bare minimum dependency stack needed to get a swift environment going?

I think the list of packages in the Linux section here, though if you're running trunk snapshots, you may need to augment those with some linux packages from the Docker too.

Nightly Docker images use this Amazon Linux 2 Dockerfile - swift-docker/Dockerfile at main · apple/swift-docker · GitHub. This should have most up to date dependencies.

1 Like