Skip to content

Instantly share code, notes, and snippets.

@marius-serban
Created December 20, 2015 20:28
Show Gist options
  • Save marius-serban/038249e4959baaadb532 to your computer and use it in GitHub Desktop.
Save marius-serban/038249e4959baaadb532 to your computer and use it in GitHub Desktop.
Swift on Docker
#!/bin/bash
docker build -t swift ./
FROM ubuntu:15.10
# Latest Swift Version
ENV SWIFT_VERSION 2.2-SNAPSHOT-2015-12-01-b
ENV SWIFT_PLATFORM ubuntu15.10
# Install Dependencies
RUN apt-get update && \
apt-get install -y \
clang \
libicu55 \
libpython2.7 \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install Swift keys
RUN wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import - && \
gpg --keyserver hkp://pool.sks-keyservers.net --refresh-keys Swift
# Download and install Swift
RUN SWIFT_ARCHIVE_NAME=swift-$SWIFT_VERSION-$SWIFT_PLATFORM && \
SWIFT_URL=https://swift.org/builds/$(echo "$SWIFT_PLATFORM" | tr -d .)/swift-$SWIFT_VERSION/$SWIFT_ARCHIVE_NAME.tar.gz && \
wget $SWIFT_URL && \
wget $SWIFT_URL.sig && \
gpg --verify $SWIFT_ARCHIVE_NAME.tar.gz.sig && \
tar -xvzf $SWIFT_ARCHIVE_NAME.tar.gz -C / --strip 1 && \
rm -rf $SWIFT_ARCHIVE_NAME* /tmp/* /var/tmp/*
#Building a webserver? Expose Port 80 by uncommenting the following.
#Expose 80
#Copy our sample swift program into the Docker image
COPY fibonacci.swift /tmp/
#!/bin/bash
docker run -it swift /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment