From 142ee439069a6cf33047ab8ac3d41dd0de77bf91 Mon Sep 17 00:00:00 2001 From: tomer doron Date: Mon, 5 Mar 2018 19:37:29 +0900 Subject: [PATCH] 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 --- README.md | 2 +- docker/Dockerfile.xenial | 33 --------------------------------- docker/docker-compose.yaml | 35 +++++++++++++++++++++++------------ 3 files changed, 24 insertions(+), 46 deletions(-) delete mode 100644 docker/Dockerfile.xenial diff --git a/README.md b/README.md index 46b1d785..cd786428 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ First make sure you have [Docker](https://www.docker.com/community-edition) inst - `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` diff --git a/docker/Dockerfile.xenial b/docker/Dockerfile.xenial deleted file mode 100644 index efb25915..00000000 --- a/docker/Dockerfile.xenial +++ /dev/null @@ -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 diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index ee93c071..424e69c2 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -1,46 +1,57 @@ version: "3" + services: + swift-nio: image: swift-nio:latest build: context: . - dockerfile: Dockerfile.xenial - args: - version: 4.0 + dockerfile: Dockerfile + + 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: - ~/.ssh:/root/.ssh - ..:/code working_dir: /code test: - depends_on: - - swift-nio + depends_on: [swift-nio] image: swift-nio:latest - command: swift test + command: /bin/bash -cl "swift test && ./scripts/integration_tests.sh" volumes: - ~/.ssh:/root/.ssh - ..:/code working_dir: /code echo: - depends_on: - - swift-nio + depends_on: [swift-nio] image: swift-nio:latest ports: - "9999:9999" - command: swift run NIOEchoServer 0.0.0.0 9999 + command: /bin/bash -cl "swift run NIOEchoServer 0.0.0.0 9999" volumes: - ~/.ssh:/root/.ssh - ..:/code working_dir: /code http: - depends_on: - - swift-nio + depends_on: [swift-nio] image: swift-nio:latest ports: - "8888:8888" - command: swift run NIOHTTP1Server 0.0.0.0 8888 + command: /bin/bash -cl "swift run NIOHTTP1Server 0.0.0.0 8888" volumes: - ~/.ssh:/root/.ssh - ..:/code