Created
March 27, 2017 13:13
-
-
Save mz2/a70694d7f260b46013055bf8b1380e9e to your computer and use it in GitHub Desktop.
Example Dockerfile for Heroku deployment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# adapted from https://github.com/swiftdocker/docker-swift | |
# once docker-swift supports setting the swift version via a build-arg we could pull from there instead | |
FROM ubuntu:14.04 | |
ENV SWIFT_BRANCH swift-3.0.2-release | |
ENV SWIFT_VERSION 3.0.2 | |
ENV SWIFT_URL https://swift.org/builds/swift-3.0.2-release/ubuntu1404/swift-3.0.2-RELEASE/swift-3.0.2-RELEASE-ubuntu14.04.tar.gz | |
ENV SWIFT_SIG_URL https://swift.org/builds/swift-3.0.2-release/ubuntu1404/swift-3.0.2-RELEASE/swift-3.0.2-RELEASE-ubuntu14.04.tar.gz.sig | |
ENV SWIFT_PLATFORM ubuntu14.04 | |
ENV SWIFT_ARCHIVE_NAME $SWIFT_VERSION-$SWIFT_PLATFORM | |
ENV SWIFT_ARCHIVE_TARBALL $SWIFT_ARCHIVE_NAME.tar.gz | |
ENV SWIFT_ARCHIVE_TARBALL_SIG $SWIFT_ARCHIVE_NAME.tar.gz.sig | |
# Install related packages and set LLVM 3.6 as the compiler | |
RUN apt-get update && \ | |
apt-get install -y build-essential wget clang-3.6 curl libedit-dev python2.7 python2.7-dev libicu52 rsync libxml2 git libpq5 libpq-dev libpq5 libpq-dev && \ | |
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.6 100 && \ | |
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 100 && \ | |
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 | |
# Install Swift Ubuntu 14.04 Snapshot | |
RUN wget $SWIFT_URL -O $SWIFT_ARCHIVE_TARBALL && \ | |
wget $SWIFT_SIG_URL -O $SWIFT_ARCHIVE_TARBALL_SIG && \ | |
gpg --verify $SWIFT_ARCHIVE_TARBALL_SIG && \ | |
tar -xvzf $SWIFT_ARCHIVE_TARBALL --directory / --strip-components=1 && \ | |
rm -rf $SWIFT_ARCHIVE_NAME* /tmp/* /var/tmp/* | |
# Set Swift Path | |
ENV PATH /usr/bin:$PATH | |
ADD . /vapor | |
# vapor specific part | |
WORKDIR /vapor | |
# mount in local sources via: -v $(PWD):/vapor | |
# the vapor CLI command does this | |
RUN swift build | |
CMD echo "PORT: ${PORT}" && .build/debug/App --env=production |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment