Skip to content

Instantly share code, notes, and snippets.

@ditansu
Last active July 30, 2019 09:58
Show Gist options
  • Save ditansu/967505f7ed8ffabccec067eded189151 to your computer and use it in GitHub Desktop.
Save ditansu/967505f7ed8ffabccec067eded189151 to your computer and use it in GitHub Desktop.
Docker base swift base for 4.2.4 + Dockerfile for use base docker
FROM path/to/your/registry/swift-image:4.2.4
WORKDIR /app
RUN apt-get update && \
apt-get -y install libxml2 libbsd0 tzdata libicu55 libcurl3 libatomic1 && \
rm -rf /var/lib/apt/lists/*
COPY .build/debug/Run ./Run
EXPOSE 8080
ENTRYPOINT ["./Run", "serve"]
CMD ["--env", "production"]
FROM ibmcom/ubuntu:16.04
MAINTAINER IBM Swift Engineering at IBM Cloud
LABEL Description="Linux Ubuntu 16.04 image for execution of Swift applications."
USER root
# Set environment variables for image
ENV VERSION=4.2.4
ENV SWIFT_SNAPSHOT swift-${VERSION}-RELEASE
ENV SWIFT_SNAPSHOT_LOWERCASE swift-${VERSION}-release
ENV UBUNTU_VERSION ubuntu16.04
ENV UBUNTU_VERSION_NO_DOTS ubuntu1604
ENV WORK_DIR /
# Set WORKDIR
WORKDIR ${WORK_DIR}
# Linux OS utils & Swift libraries
RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y \
libicu-dev \
libcurl4-openssl-dev \
wget \
&& apt-get clean \
&& wget -q https://swift.org/builds/$SWIFT_SNAPSHOT_LOWERCASE/$UBUNTU_VERSION_NO_DOTS/$SWIFT_SNAPSHOT/$SWIFT_SNAPSHOT-$UBUNTU_VERSION.tar.gz \
https://swift.org/builds/$SWIFT_SNAPSHOT_LOWERCASE/$UBUNTU_VERSION_NO_DOTS/$SWIFT_SNAPSHOT/$SWIFT_SNAPSHOT-$UBUNTU_VERSION.tar.gz.sig \
&& gpg --keyserver hkp://pool.sks-keyservers.net \
--recv-keys \
'7463 A81A 4B2E EA1B 551F FBCF D441 C977 412B 37AD' \
'1BE1 E29A 084C B305 F397 D62A 9F59 7F4D 21A5 6D5F' \
'A3BA FD35 56A5 9079 C068 94BD 63BC 1CFE 91D3 06C6' \
'5E4D F843 FB06 5D7F 7E24 FBA2 EF54 30F0 71E1 B235' \
'8513 444E 2DA3 6B7C 1659 AF4D 7638 F1FB 2B2B 08C4' \
'A62A E125 BBBF BB96 A6E0 42EC 925C C1CC ED3D 1561' \
&& gpg --keyserver hkp://pool.sks-keyservers.net --refresh-keys \
&& gpg --verify $SWIFT_SNAPSHOT-$UBUNTU_VERSION.tar.gz.sig \
&& tar xzvf $SWIFT_SNAPSHOT-$UBUNTU_VERSION.tar.gz $SWIFT_SNAPSHOT-$UBUNTU_VERSION/usr/lib/swift/linux --strip-components=1 \
&& rm $SWIFT_SNAPSHOT-$UBUNTU_VERSION.tar.gz \
&& rm $SWIFT_SNAPSHOT-$UBUNTU_VERSION.tar.gz.sig \
&& find /usr/lib/swift/linux -type f ! -name '*.so*' -delete \
&& rm -rf /usr/lib/swift/linux/*/ \
&& chmod -R go+r /usr/lib/swift \
&& apt-get remove -y gcc cpp sgml-base icu-devtools gcc-4.8 cpp-4.8 libc6-dev binutils manpages-dev manpages wget pkg-config perl \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
CMD /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment