Skip to content

Commit 7e28645

Browse files
committed
add docker support
motivation: enable CI changes: add docker files support for ubuntu 16.04 and 18.04 and swift 5.0 and 5.1 note that eventyally this will need to move to AL2 docker images, but we dont have official ones yet
1 parent 95cf94e commit 7e28645

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed

docker/Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
ARG swift_version=5.0
2+
ARG ubuntu_version=bionic
3+
FROM swift:$swift_version-$ubuntu_version
4+
# needed to do again after FROM due to docker limitation
5+
ARG swift_version
6+
ARG ubuntu_version
7+
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
13+
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 curl jq # used by integration tests
17+
18+
# ruby and jazzy for docs generation
19+
RUN apt-get update && apt-get install -y ruby ruby-dev libsqlite3-dev
20+
RUN gem install jazzy --no-ri --no-rdoc
21+
22+
# tools
23+
RUN mkdir -p $HOME/.tools
24+
RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile
25+
26+
# script to allow mapping framepointers on linux (until part of the toolchain)
27+
RUN wget -q https://raw.githubusercontent.com/apple/swift/master/utils/symbolicate-linux-fatal -O $HOME/.tools/symbolicate-linux-fatal
28+
RUN chmod 755 $HOME/.tools/symbolicate-linux-fatal
29+
30+
# swiftformat (until part of the toolchain)
31+
32+
ARG swiftformat_version=0.40.12
33+
RUN git clone --branch $swiftformat_version --depth 1 https://github.com/nicklockwood/SwiftFormat $HOME/.tools/swift-format
34+
RUN cd $HOME/.tools/swift-format && swift build -c release
35+
RUN ln -s $HOME/.tools/swift-format/.build/release/swiftformat $HOME/.tools/swiftformat

docker/docker-compose.1604.51.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: "3"
2+
3+
services:
4+
5+
runtime-setup:
6+
image: swift-aws-lambda:16.04-5.1
7+
build:
8+
args:
9+
ubuntu_version: "xenial"
10+
swift_version: "5.1"
11+
12+
test:
13+
image: swift-aws-lambda:16.04-5.1
14+
15+
shell:
16+
image: swift-aws-lambda:16.04-5.1

docker/docker-compose.1804.50.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: "3"
2+
3+
services:
4+
5+
runtime-setup:
6+
image: swift-aws-lambda:18.04-5.0
7+
build:
8+
args:
9+
ubuntu_version: "bionic"
10+
swift_version: "5.0"
11+
12+
test:
13+
image: swift-aws-lambda:18.04-5.0
14+
15+
shell:
16+
image: swift-aws-lambda:18.04-5.0

docker/docker-compose.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# this file is not designed to be run directly
2+
# instead, use the docker-compose.<os>.<swift> files
3+
# eg docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.1804.50.yaml run test
4+
version: "3"
5+
6+
services:
7+
8+
runtime-setup:
9+
image: swift-aws-lambda:default
10+
build:
11+
context: .
12+
dockerfile: Dockerfile
13+
14+
common: &common
15+
image: swift-aws-lambda:default
16+
depends_on: [runtime-setup]
17+
volumes:
18+
- ~/.ssh:/root/.ssh
19+
- ..:/code:z
20+
working_dir: /code
21+
cap_drop:
22+
- CAP_NET_RAW
23+
- CAP_NET_BIND_SERVICE
24+
25+
sanity:
26+
<<: *common
27+
command: /bin/bash -cl "./scripts/sanity.sh"
28+
29+
test:
30+
<<: *common
31+
command: /bin/bash -cl "swift test -Xswiftc -warnings-as-errors"
32+
33+
# util
34+
35+
shell:
36+
<<: *common
37+
entrypoint: /bin/bash

0 commit comments

Comments
 (0)