1+ ARG UBUNTU_VERSION=22.04
2+ ARG SWIFT_MAJOR_VERSION=8
3+ ARG SWIFT_MINOR_VERSION=1
4+ ARG CUSTOM_CERT
5+ ARG ENABLE_LEGACY_RENEGOTIATION
6+
7+ FROM ubuntu:$UBUNTU_VERSION
8+
9+ ARG SWIFT_MAJOR_VERSION
10+ ARG SWIFT_MINOR_VERSION
11+ ARG CUSTOM_CERT
12+ ARG ENABLE_LEGACY_RENEGOTIATION
13+
14+ ENV DEBIAN_FRONTEND=noninteractive
15+
16+ # Install the base dependencies
17+ RUN apt-get update && apt-get install -y --no-install-recommends \
18+ python3 \
19+ python3-dev \
20+ python-is-python3 \
21+ wget \
22+ curl \
23+ ca-certificates \
24+ build-essential \
25+ pkg-config \
26+ bzip2 \
27+ gcc \
28+ g++ \
29+ gfortran \
30+ cmake \
31+ ninja-build \
32+ git \
33+ make \
34+ libssl-dev
35+
36+ # Setup a custom certificate/SSL settings depending upon build arguments
37+ # Include README.md here so that the build doesn't fail if there is no custom
38+ # certificate specified. Then we just delete it afterwards.
39+ COPY README.md $CUSTOM_CERT /usr/local/share/ca-certificates/
40+ RUN rm /usr/local/share/ca-certificates/README.md \
41+ && update-ca-certificates
42+ RUN if [ -n "$ENABLE_LEGACY_RENEGOTIATION" ]; then echo "Options = UnsafeLegacyRenegotiation" >> /etc/ssl/openssl.cnf ; fi
43+
44+ # Install Swift
45+ RUN curl \
46+ https://download.swift.org/swift-5.8.1-release/ubuntu2204/swift-5.8.1-RELEASE/swift-5.8.1-RELEASE-ubuntu22.04.tar.gz \
47+ | tar -xz
48+ RUN mv swift-5.$SWIFT_MAJOR_VERSION.$SWIFT_MINOR_VERSION-RELEASE-ubuntu22.04/usr/ /opt/swift-5.$SWIFT_MAJOR_VERSION.$SWIFT_MINOR_VERSION/
49+ ENV PATH="${PATH}:/opt/swift-5.$SWIFT_MAJOR_VERSION.$SWIFT_MINOR_VERSION/bin/"
50+
51+ # Set up the Python dependencies
52+ COPY Pipfile* ./
53+ RUN pip3 install pipenv \
54+ && pipenv sync --categories "packages dev-packages" --system \
55+ && pipenv --clear \
56+ && rm Pipfile*
57+
58+ # Clean up the Docker container to make the image smaller
59+ RUN apt-get autoremove -y --purge \
60+ && apt-get clean -y \
61+ && rm -rf /var/lib/apt/lists/*
62+
63+ ENV DEBIAN_FRONTEND=
0 commit comments