docker cleanup (#90)
Motivation: repository currently contains two seperate docker definitions that are confusing to users Modifications: * remove Dockerfile.xenial so we have a canonical docker file for CI and developer testing * point docker compose to canonical docker file * define docker compose services for unit and integration tests. and make "test" service run both * update readme Result: users are less confused about docker setup
This commit is contained in:
parent
8b8951eadd
commit
142ee43906
|
@ -171,7 +171,7 @@ First make sure you have [Docker](https://www.docker.com/community-edition) inst
|
||||||
|
|
||||||
- `docker-compose up test`
|
- `docker-compose up test`
|
||||||
|
|
||||||
Will create a base image with Swift 4.0 (if missing), compile SwiftNIO and run the tests
|
Will create a base image with Swift runtime and other build and test dependencies, compile SwiftNIO and run the unit and integration tests
|
||||||
|
|
||||||
- `docker-compose up echo`
|
- `docker-compose up echo`
|
||||||
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
FROM ubuntu:16.04
|
|
||||||
|
|
||||||
ARG version=4.0
|
|
||||||
|
|
||||||
# install dependencies
|
|
||||||
RUN set -ex ; \
|
|
||||||
apt-get -y update && apt-get -y install \
|
|
||||||
clang \
|
|
||||||
curl \
|
|
||||||
git \
|
|
||||||
libcurl3 \
|
|
||||||
libicu-dev \
|
|
||||||
libpython2.7-dev \
|
|
||||||
libssl-dev \
|
|
||||||
libstdc++6 \
|
|
||||||
libxml2 \
|
|
||||||
pkg-config \
|
|
||||||
python-lldb-3.9 \
|
|
||||||
wget \
|
|
||||||
; \
|
|
||||||
rm -rf /var/lib/apt/lists/* ; \
|
|
||||||
mkdir -p /scripts ; \
|
|
||||||
echo 'export PATH="/scripts:$PATH"' >> ~/.profile ; \
|
|
||||||
wget -q https://raw.githubusercontent.com/apple/swift/1e078fbdfa768e211e0473cf917511efd73aec86/utils/symbolicate-linux-fatal \
|
|
||||||
-O /scripts/symbolicate-linux-fatal ; \
|
|
||||||
chmod 755 /scripts/symbolicate-linux-fatal
|
|
||||||
|
|
||||||
RUN set -ex ; \
|
|
||||||
wget -q https://swift.org/builds/swift-${version}-release/ubuntu1604/swift-${version}-RELEASE/swift-${version}-RELEASE-ubuntu16.04.tar.gz ; \
|
|
||||||
tar xzpf swift-${version}-RELEASE-ubuntu16.04.tar.gz --strip-components 1 -C / ; \
|
|
||||||
rm swift-${version}-RELEASE-ubuntu16.04.tar.gz
|
|
||||||
|
|
||||||
VOLUME /code
|
|
|
@ -1,46 +1,57 @@
|
||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
swift-nio:
|
swift-nio:
|
||||||
image: swift-nio:latest
|
image: swift-nio:latest
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.xenial
|
dockerfile: Dockerfile
|
||||||
args:
|
|
||||||
version: 4.0
|
unit-tests:
|
||||||
|
depends_on: [swift-nio]
|
||||||
|
image: swift-nio:latest
|
||||||
|
command: /bin/bash -cl "swift test"
|
||||||
|
volumes:
|
||||||
|
- ~/.ssh:/root/.ssh
|
||||||
|
- ..:/code
|
||||||
|
working_dir: /code
|
||||||
|
|
||||||
|
integration-tests:
|
||||||
|
depends_on: [swift-nio]
|
||||||
|
image: swift-nio:latest
|
||||||
|
command: /bin/bash -cl "./scripts/integration_tests.sh"
|
||||||
volumes:
|
volumes:
|
||||||
- ~/.ssh:/root/.ssh
|
- ~/.ssh:/root/.ssh
|
||||||
- ..:/code
|
- ..:/code
|
||||||
working_dir: /code
|
working_dir: /code
|
||||||
|
|
||||||
test:
|
test:
|
||||||
depends_on:
|
depends_on: [swift-nio]
|
||||||
- swift-nio
|
|
||||||
image: swift-nio:latest
|
image: swift-nio:latest
|
||||||
command: swift test
|
command: /bin/bash -cl "swift test && ./scripts/integration_tests.sh"
|
||||||
volumes:
|
volumes:
|
||||||
- ~/.ssh:/root/.ssh
|
- ~/.ssh:/root/.ssh
|
||||||
- ..:/code
|
- ..:/code
|
||||||
working_dir: /code
|
working_dir: /code
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
depends_on:
|
depends_on: [swift-nio]
|
||||||
- swift-nio
|
|
||||||
image: swift-nio:latest
|
image: swift-nio:latest
|
||||||
ports:
|
ports:
|
||||||
- "9999:9999"
|
- "9999:9999"
|
||||||
command: swift run NIOEchoServer 0.0.0.0 9999
|
command: /bin/bash -cl "swift run NIOEchoServer 0.0.0.0 9999"
|
||||||
volumes:
|
volumes:
|
||||||
- ~/.ssh:/root/.ssh
|
- ~/.ssh:/root/.ssh
|
||||||
- ..:/code
|
- ..:/code
|
||||||
working_dir: /code
|
working_dir: /code
|
||||||
|
|
||||||
http:
|
http:
|
||||||
depends_on:
|
depends_on: [swift-nio]
|
||||||
- swift-nio
|
|
||||||
image: swift-nio:latest
|
image: swift-nio:latest
|
||||||
ports:
|
ports:
|
||||||
- "8888:8888"
|
- "8888:8888"
|
||||||
command: swift run NIOHTTP1Server 0.0.0.0 8888
|
command: /bin/bash -cl "swift run NIOHTTP1Server 0.0.0.0 8888"
|
||||||
volumes:
|
volumes:
|
||||||
- ~/.ssh:/root/.ssh
|
- ~/.ssh:/root/.ssh
|
||||||
- ..:/code
|
- ..:/code
|
||||||
|
|
Loading…
Reference in New Issue