|
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 |
3 | 4 | # needed to do again after FROM due to docker limitation |
| 5 | +ARG swift_version |
4 | 6 | ARG ubuntu_version |
5 | 7 |
|
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 |
9 | 13 |
|
10 | | -# basic dependencies |
11 | | -RUN apt-get update && apt-get install -y wget git build-essential software-properties-common pkg-config locales expect |
12 | | -RUN apt-get update && apt-get install -y libicu-dev libblocksruntime0 libssl-dev |
13 | | - |
14 | | -# local |
15 | | -RUN locale-gen en_US.UTF-8 |
16 | | -RUN locale-gen en_US en_US.UTF-8 |
17 | | -RUN dpkg-reconfigure locales |
18 | | -RUN echo 'export LANG=en_US.UTF-8' >> $HOME/.profile |
19 | | -RUN echo 'export LANGUAGE=en_US:en' >> $HOME/.profile |
20 | | -RUN echo 'export LC_ALL=en_US.UTF-8' >> $HOME/.profile |
21 | | - |
22 | | -# known_hosts |
23 | | -RUN mkdir -p $HOME/.ssh |
24 | | -RUN touch $HOME/.ssh/known_hosts |
25 | | -RUN ssh-keyscan github.com 2> /dev/null >> $HOME/.ssh/known_hosts |
26 | | - |
27 | | -# clang |
28 | | -RUN apt-get update && apt-get install -y clang-3.9 |
29 | | -RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.9 100 |
30 | | -RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.9 100 |
31 | | - |
32 | | -# modern curl, if needed |
33 | | -ARG install_curl_from_source |
34 | | -RUN apt-get update && apt-get install -y curl libcurl4-openssl-dev libz-dev |
| 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 expect # used by integration tests |
| 17 | +RUN apt-get update && apt-get install -y libssl-dev |
35 | 18 |
|
36 | 19 | # ruby and jazzy for docs generation |
37 | | -ARG skip_ruby_from_ppa |
38 | | -RUN [ -n "$skip_ruby_from_ppa" ] || apt-add-repository -y ppa:brightbox/ruby-ng |
39 | | -RUN [ -n "$skip_ruby_from_ppa" ] || { apt-get update && apt-get install -y ruby2.4 ruby2.4-dev; } |
40 | | -RUN [ -z "$skip_ruby_from_ppa" ] || { apt-get update && apt-get install -y ruby ruby-dev; } |
41 | | -RUN apt-get update && apt-get install -y libsqlite3-dev |
| 20 | +RUN apt-get update && apt-get install -y ruby ruby-dev libsqlite3-dev |
42 | 21 | RUN gem install jazzy --no-ri --no-rdoc |
43 | 22 |
|
44 | | -# swift |
45 | | -ARG swift_version=4.0.3 |
46 | | -ARG swift_flavour=RELEASE |
47 | | -ARG swift_builds_suffix=release |
| 23 | +# tools |
| 24 | +RUN mkdir -p $HOME/.tools |
| 25 | +RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile |
| 26 | + |
| 27 | +# script to allow mapping framepointers on linux (until part of the toolchain) |
| 28 | +RUN wget -q https://raw.githubusercontent.com/apple/swift/master/utils/symbolicate-linux-fatal -O $HOME/.tools/symbolicate-linux-fatal |
| 29 | +RUN chmod 755 $HOME/.tools/symbolicate-linux-fatal |
48 | 30 |
|
49 | | -RUN mkdir $HOME/.swift |
50 | | -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 |
51 | | -RUN tar xzf $HOME/swift.tar.gz --directory $HOME/.swift --strip-components=1 |
52 | | -RUN echo 'export PATH="$HOME/.swift/usr/bin:$PATH"' >> $HOME/.profile |
53 | | -RUN echo 'export LINUX_SOURCEKIT_LIB_PATH="$HOME/.swift/usr/lib"' >> $HOME/.profile |
| 31 | +# swiftformat (until part of the toolchain) |
54 | 32 |
|
55 | | -# script to allow mapping framepointers on linux |
56 | | -RUN mkdir -p $HOME/.scripts |
57 | | -RUN wget -q https://raw.githubusercontent.com/apple/swift/master/utils/symbolicate-linux-fatal -O $HOME/.scripts/symbolicate-linux-fatal |
58 | | -RUN chmod 755 $HOME/.scripts/symbolicate-linux-fatal |
59 | | -RUN echo 'export PATH="$HOME/.scripts:$PATH"' >> $HOME/.profile |
| 33 | +ARG swiftformat_version=0.40.12 |
| 34 | +RUN git clone --branch $swiftformat_version --depth 1 https://github.com/nicklockwood/SwiftFormat $HOME/.tools/swift-format |
| 35 | +RUN cd $HOME/.tools/swift-format && swift build -c release |
| 36 | +RUN ln -s $HOME/.tools/swift-format/.build/release/swiftformat $HOME/.tools/swiftformat |
0 commit comments