mirror of
https://github.com/apple/swift-nio-extras.git
synced 2025-05-15 01:18:58 +08:00
add docker setup (#4)
Motivation: We need the docker setup for CI. Modifications: Added docker setup. Started with swift-nio's setup and then removed everything that we don't need (test, http, echo, integration-tests). Result: We can move forward doing CI.
This commit is contained in:
parent
4b14b7f2b1
commit
2516d61aee
@ -31,3 +31,4 @@ extension QuiescingHelperTest {
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
61
docker/Dockerfile
Normal file
61
docker/Dockerfile
Normal file
@ -0,0 +1,61 @@
|
||||
ARG ubuntu_version=16.04
|
||||
FROM ubuntu:$ubuntu_version
|
||||
# needed to do again after FROM due to docker limitation
|
||||
ARG ubuntu_version
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
# do not start services during installation as this will fail and log a warning / error.
|
||||
RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d
|
||||
|
||||
# basic dependencies
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y wget git build-essential software-properties-common pkg-config locales
|
||||
RUN apt-get install -y libicu-dev libblocksruntime0
|
||||
|
||||
# local
|
||||
RUN locale-gen en_US.UTF-8
|
||||
RUN locale-gen en_US en_US.UTF-8
|
||||
RUN dpkg-reconfigure locales
|
||||
RUN echo 'export LANG=en_US.UTF-8' >> $HOME/.profile
|
||||
RUN echo 'export LANGUAGE=en_US:en' >> $HOME/.profile
|
||||
RUN echo 'export LC_ALL=en_US.UTF-8' >> $HOME/.profile
|
||||
|
||||
# known_hosts
|
||||
RUN mkdir -p $HOME/.ssh
|
||||
RUN touch $HOME/.ssh/known_hosts
|
||||
RUN ssh-keyscan github.com 2> /dev/null >> $HOME/.ssh/known_hosts
|
||||
|
||||
# clang
|
||||
RUN apt-get install -y clang-3.9
|
||||
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.9 100
|
||||
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.9 100
|
||||
|
||||
# modern curl, if needed
|
||||
ARG install_curl_from_source
|
||||
RUN [ ! -z $install_curl_from_source ] || apt-get install -y curl libcurl3 libz-dev
|
||||
RUN [ -z $install_curl_from_source ] || apt-get install -y libssl-dev
|
||||
RUN [ -z $install_curl_from_source ] || mkdir $HOME/.curl
|
||||
RUN [ -z $install_curl_from_source ] || wget -q https://curl.haxx.se/download/curl-7.50.3.tar.gz -O $HOME/curl.tar.gz
|
||||
RUN [ -z $install_curl_from_source ] || tar xzf $HOME/curl.tar.gz --directory $HOME/.curl --strip-components=1
|
||||
RUN [ -z $install_curl_from_source ] || ( cd $HOME/.curl && ./configure --with-ssl && make && make install && cd - )
|
||||
RUN [ -z $install_curl_from_source ] || ldconfig
|
||||
|
||||
# ruby and jazzy for docs generation
|
||||
RUN apt-add-repository -y ppa:brightbox/ruby-ng
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y ruby2.4 ruby2.4-dev libsqlite3-dev
|
||||
RUN gem install jazzy --no-ri --no-rdoc
|
||||
|
||||
# swift
|
||||
ARG swift_version=4.0.3
|
||||
RUN mkdir $HOME/.swift
|
||||
RUN wget -q https://swift.org/builds/swift-${swift_version}-release/ubuntu$(echo $ubuntu_version | sed 's/\.//g')/swift-${swift_version}-RELEASE/swift-${swift_version}-RELEASE-ubuntu${ubuntu_version}.tar.gz -O $HOME/swift.tar.gz
|
||||
RUN tar xzf $HOME/swift.tar.gz --directory $HOME/.swift --strip-components=1
|
||||
RUN echo 'export PATH="$HOME/.swift/usr/bin:$PATH"' >> $HOME/.profile
|
||||
RUN echo 'export LINUX_SOURCEKIT_LIB_PATH="$HOME/.swift/usr/lib"' >> $HOME/.profile
|
||||
|
||||
# script to allow mapping framepointers on linux
|
||||
RUN mkdir -p $HOME/.scripts
|
||||
RUN wget -q https://raw.githubusercontent.com/apple/swift/master/utils/symbolicate-linux-fatal -O $HOME/.scripts/symbolicate-linux-fatal
|
||||
RUN chmod 755 $HOME/.scripts/symbolicate-linux-fatal
|
||||
RUN echo 'export PATH="$HOME/.scripts:$PATH"' >> $HOME/.profile
|
14
docker/docker-compose.1404.403.yaml
Normal file
14
docker/docker-compose.1404.403.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
|
||||
runtime-setup:
|
||||
image: swift-nio-extras:14.04-4.0.3
|
||||
build:
|
||||
args:
|
||||
ubuntu_version : "14.04"
|
||||
swift_version : "4.0.3"
|
||||
install_curl_from_source: "true"
|
||||
|
||||
test:
|
||||
image: swift-nio-extras:14.04-4.0.3
|
14
docker/docker-compose.1404.41.yaml
Normal file
14
docker/docker-compose.1404.41.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
|
||||
runtime-setup:
|
||||
image: swift-nio-extras:14.04-4.1
|
||||
build:
|
||||
args:
|
||||
ubuntu_version : "14.04"
|
||||
swift_version : "4.1"
|
||||
install_curl_from_source: "true"
|
||||
|
||||
test:
|
||||
image: swift-nio-extras:14.04-4.1
|
13
docker/docker-compose.1604.403.yaml
Normal file
13
docker/docker-compose.1604.403.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
|
||||
runtime-setup:
|
||||
image: swift-nio-extras:16.04-4.0.3
|
||||
build:
|
||||
args:
|
||||
ubuntu_version : "16.04"
|
||||
swift_version : "4.0.3"
|
||||
|
||||
test:
|
||||
image: swift-nio-extras:16.04-4.0.3
|
13
docker/docker-compose.1604.41.yaml
Normal file
13
docker/docker-compose.1604.41.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
|
||||
runtime-setup:
|
||||
image: swift-nio-extras:16.04-4.1
|
||||
build:
|
||||
args:
|
||||
ubuntu_version : "16.04"
|
||||
swift_version : "4.1"
|
||||
|
||||
test:
|
||||
image: swift-nio-extras:16.04-4.1
|
28
docker/docker-compose.yaml
Normal file
28
docker/docker-compose.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
# this file is not designed to be run directly
|
||||
# instead, use the docker-compose.<os>.<swift> files
|
||||
# eg docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.1604.41.yaml run test
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
|
||||
runtime-setup:
|
||||
image: swift-nio-extras:default
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
|
||||
common: &common
|
||||
image: swift-nio-extras:default
|
||||
depends_on: [runtime-setup]
|
||||
volumes:
|
||||
- ~/.ssh:/root/.ssh
|
||||
- ..:/code
|
||||
working_dir: /code
|
||||
|
||||
sanity:
|
||||
<<: *common
|
||||
command: /bin/bash -cl "./scripts/sanity.sh"
|
||||
|
||||
test:
|
||||
<<: *common
|
||||
command: /bin/bash -cl "swift test"
|
Loading…
x
Reference in New Issue
Block a user