Skip to content

Commit c7c0ca9

Browse files
authored
use official docker image (#130)
motivation: now that swift has official docker images, use them instead of the homebrewed one changes: refactor docker file to use swift:version instead of ubuntu:version
1 parent e25490e commit c7c0ca9

File tree

2 files changed

+20
-66
lines changed

2 files changed

+20
-66
lines changed

docker/Dockerfile

Lines changed: 19 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,33 @@
1-
ARG ubuntu_version=16.04
2-
FROM ubuntu:$ubuntu_version
1+
ARG swift_version=5.0
2+
ARG ubuntu_version=bionic
3+
FROM swift:$swift_version-$ubuntu_version
34
# needed to do again after FROM due to docker limitation
5+
ARG swift_version
46
ARG ubuntu_version
57

6-
ARG DEBIAN_FRONTEND=noninteractive
7-
# do not start services during installation as this will fail and log a warning / error.
8-
RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d
8+
# set as UTF-8
9+
RUN apt-get update && apt-get install -y locales locales-all
10+
ENV LC_ALL en_US.UTF-8
11+
ENV LANG en_US.UTF-8
12+
ENV LANGUAGE en_US.UTF-8
913

10-
# basic dependencies
11-
RUN apt-get update
12-
RUN apt-get install -y wget git build-essential software-properties-common pkg-config locales
13-
RUN apt-get install -y libicu-dev libblocksruntime0
14-
RUN apt-get install -y lsof dnsutils netcat-openbsd # used by integration tests
15-
16-
# local
17-
RUN locale-gen en_US.UTF-8
18-
RUN locale-gen en_US en_US.UTF-8
19-
RUN dpkg-reconfigure locales
20-
RUN echo 'export LANG=en_US.UTF-8' >> $HOME/.profile
21-
RUN echo 'export LANGUAGE=en_US:en' >> $HOME/.profile
22-
RUN echo 'export LC_ALL=en_US.UTF-8' >> $HOME/.profile
23-
24-
# known_hosts
25-
RUN mkdir -p $HOME/.ssh
26-
RUN touch $HOME/.ssh/known_hosts
27-
RUN ssh-keyscan github.com 2> /dev/null >> $HOME/.ssh/known_hosts
28-
29-
# clang
30-
RUN apt-get install -y clang-3.9
31-
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.9 100
32-
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.9 100
33-
34-
# modern curl, if needed
35-
ARG install_curl_from_source
36-
RUN [ ! -z $install_curl_from_source ] || { apt-get update && apt-get install -y curl libcurl4-openssl-dev libz-dev; }
37-
RUN [ -z $install_curl_from_source ] || { apt-get update && apt-get install -y libssl-dev; }
38-
RUN [ -z $install_curl_from_source ] || mkdir $HOME/.curl
39-
RUN [ -z $install_curl_from_source ] || wget -q https://curl.haxx.se/download/curl-7.50.3.tar.gz -O $HOME/curl.tar.gz
40-
RUN [ -z $install_curl_from_source ] || tar xzf $HOME/curl.tar.gz --directory $HOME/.curl --strip-components=1
41-
RUN [ -z $install_curl_from_source ] || ( cd $HOME/.curl && ./configure --with-ssl && make && make install && cd - )
42-
RUN [ -z $install_curl_from_source ] || ldconfig
14+
# dependencies
15+
RUN apt-get update && apt-get install -y wget
16+
RUN apt-get update && apt-get install -y lsof dnsutils netcat-openbsd net-tools # used by integration tests
4317

4418
# ruby and jazzy for docs generation
4519
RUN apt-get update && apt-get install -y ruby ruby-dev libsqlite3-dev
4620
RUN gem install jazzy --no-ri --no-rdoc
4721

48-
# nghttp2
49-
ARG install_nghttp2_from_source
50-
RUN [ ! -z $install_nghttp2_from_source ] || apt-get install -y nghttp2 libnghttp2-dev
51-
RUN [ -z $install_nghttp2_from_source ] || mkdir $HOME/.nghttp2
52-
RUN [ -z $install_nghttp2_from_source ] || wget -q https://github.com/nghttp2/nghttp2/releases/download/v1.32.0/nghttp2-1.32.0.tar.gz -O $HOME/nghttp2.tar.gz
53-
RUN [ -z $install_nghttp2_from_source ] || tar xzf $HOME/nghttp2.tar.gz --directory $HOME/.nghttp2 --strip-components=1
54-
RUN [ -z $install_nghttp2_from_source ] || ( cd $HOME/.nghttp2 && ./configure && make && make install && cd - )
55-
RUN [ -z $install_nghttp2_from_source ] || ldconfig
22+
# tools
23+
RUN mkdir -p $HOME/.tools
24+
RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile
5625

5726
# h2spec
5827
ARG h2spec_version
59-
RUN [ -z $h2spec_version ] || mkdir $HOME/.h2spec
60-
RUN [ -z $h2spec_version ] || wget -q https://github.com/summerwind/h2spec/releases/download/v$h2spec_version/h2spec_linux_amd64.tar.gz -O $HOME/h2spec.tar.gz
61-
RUN [ -z $h2spec_version ] || tar xzf $HOME/h2spec.tar.gz --directory $HOME/.h2spec
62-
RUN [ -z $h2spec_version ] || mv $HOME/.h2spec/h2spec /usr/local/bin/h2spec
63-
64-
# swift
65-
ARG swift_version=4.0.3
66-
ARG swift_flavour=RELEASE
67-
ARG swift_builds_suffix=release
68-
69-
RUN mkdir $HOME/.swift
70-
RUN wget -q "https://swift.org/builds/swift-${swift_version}-${swift_builds_suffix}/ubuntu$(echo $ubuntu_version | sed 's/\.//g')/swift-${swift_version}-${swift_flavour}/swift-${swift_version}-${swift_flavour}-ubuntu${ubuntu_version}.tar.gz" -O $HOME/swift.tar.gz
71-
RUN tar xzf $HOME/swift.tar.gz --directory $HOME/.swift --strip-components=1
72-
RUN echo 'export PATH="$HOME/.swift/usr/bin:$PATH"' >> $HOME/.profile
73-
RUN echo 'export LINUX_SOURCEKIT_LIB_PATH="$HOME/.swift/usr/lib"' >> $HOME/.profile
28+
RUN [ -z $h2spec_version ] || wget -q https://github.com/summerwind/h2spec/releases/download/v$h2spec_version/h2spec_linux_amd64.tar.gz -O $HOME/.tools/h2spec.tar.gz
29+
RUN [ -z $h2spec_version ] || tar xzf $HOME/.tools/h2spec.tar.gz --directory $HOME/.tools
7430

7531
# script to allow mapping framepointers on linux
76-
RUN mkdir -p $HOME/.scripts
77-
RUN wget -q https://raw.githubusercontent.com/apple/swift/master/utils/symbolicate-linux-fatal -O $HOME/.scripts/symbolicate-linux-fatal
78-
RUN chmod 755 $HOME/.scripts/symbolicate-linux-fatal
79-
RUN echo 'export PATH="$HOME/.scripts:$PATH"' >> $HOME/.profile
32+
RUN wget -q https://raw.githubusercontent.com/apple/swift/master/utils/symbolicate-linux-fatal -O $HOME/.tools/symbolicate-linux-fatal
33+
RUN chmod 755 $HOME/.tools/symbolicate-linux-fatal

docker/docker-compose.1804.50.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
image: swift-nio-http2:18.04-5.0
77
build:
88
args:
9-
ubuntu_version: "18.04"
9+
ubuntu_version: "bionic"
1010
swift_version: "5.0"
1111
h2spec_version: "2.2.1"
1212

0 commit comments

Comments
 (0)