Skip to content

Commit 55492af

Browse files
committed
Bring back Docker support
1 parent a0537ec commit 55492af

File tree

6 files changed

+137
-1
lines changed

6 files changed

+137
-1
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@
88
xcuserdata
99
Package.resolved
1010
.serverless
11-
docker
1211
.env

docker/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
ARG swift_version=5.2.5
2+
FROM stevapple/swift-scf:$swift_version
3+
# needed to do again after FROM due to docker limitation
4+
ARG swift_version
5+
6+
# dependencies
7+
RUN yum install -y wget perl-Digest-SHA lsof dnsutils netcat-openbsd net-tools curl jq && yum clean all # used by integration tests
8+
9+
# tools
10+
RUN mkdir -p $HOME/.tools
11+
RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile
12+
13+
# script to allow mapping framepointers on linux (until part of the toolchain)
14+
RUN wget -q https://raw.githubusercontent.com/apple/swift/master/utils/symbolicate-linux-fatal -O $HOME/.tools/symbolicate-linux-fatal
15+
RUN chmod 755 $HOME/.tools/symbolicate-linux-fatal
16+
17+
# swiftformat (until part of the toolchain)
18+
ARG swiftformat_version=0.45.6
19+
RUN git clone --branch $swiftformat_version --depth 1 https://github.com/nicklockwood/SwiftFormat $HOME/.tools/swift-format
20+
RUN cd $HOME/.tools/swift-format && swift build -c release
21+
RUN ln -s $HOME/.tools/swift-format/.build/release/swiftformat $HOME/.tools/swiftformat

docker/Dockerfile.ubuntu

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
ARG swift_version=5.2.5
2+
ARG ubuntu_version=bionic
3+
ARG base_image=swift:$swift_version-$ubuntu_version
4+
FROM $base_image
5+
# needed to do again after FROM due to docker limitation
6+
ARG swift_version
7+
ARG ubuntu_version
8+
9+
# set as UTF-8
10+
RUN apt-get update && apt-get install -y locales locales-all
11+
ENV LC_ALL en_US.UTF-8
12+
ENV LANG en_US.UTF-8
13+
ENV LANGUAGE en_US.UTF-8
14+
15+
# dependencies
16+
RUN apt-get update && apt-get install -y wget 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 && gem cleanup all
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+
ARG swiftformat_version=0.45.6
32+
RUN git clone --branch $swiftformat_version --depth 1 https://github.com/nicklockwood/SwiftFormat $HOME/.tools/swift-format
33+
RUN cd $HOME/.tools/swift-format && swift build -c release
34+
RUN ln -s $HOME/.tools/swift-format/.build/release/swiftformat $HOME/.tools/swiftformat

docker/docker-compose.bionic.52.yaml

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

docker/docker-compose.scf.53.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: "3"
2+
3+
services:
4+
5+
runtime-setup:
6+
image: swift-tencent-scf:scf-5.3
7+
build:
8+
args:
9+
swift_version: "nightly-5.3"
10+
11+
test:
12+
image: swift-tencent-scf:scf-5.3
13+
14+
test-samples:
15+
image: swift-tencent-scf:scf-5.3
16+
17+
shell:
18+
image: swift-tencent-scf:scf-5.3

docker/docker-compose.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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.52.yaml run test
4+
version: "3"
5+
6+
services:
7+
8+
runtime-setup:
9+
image: swift-tencent-scf:default
10+
build:
11+
context: .
12+
dockerfile: Dockerfile
13+
14+
common: &common
15+
image: swift-tencent-scf: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 --enable-test-discovery -Xswiftc -warnings-as-errors $${SANITIZER_ARG-}"
32+
33+
test-samples:
34+
<<: *common
35+
command: >-
36+
/bin/bash -clx "
37+
swift build --package-path Examples/LambdaFunctions &&
38+
swift build --package-path Examples/LocalDebugging/MyLambda"
39+
40+
# util
41+
42+
shell:
43+
<<: *common
44+
entrypoint: /bin/bash

0 commit comments

Comments
 (0)