Skip to content
This repository was archived by the owner on Apr 20, 2024. It is now read-only.

Commit b0d1264

Browse files
committed
Add docker files for Swift 5.3 and update documentation
1 parent ea16901 commit b0d1264

File tree

4 files changed

+55
-3
lines changed

4 files changed

+55
-3
lines changed

Dockerfile-Swift5.3

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM swift:5.3
2+
3+
RUN apt-get update && apt-get install -y libmysqlclient20 libmysqlclient-dev openssl libssl-dev libcurl4-openssl-dev
4+
5+
CMD ["swift", "--version"]

Hosting/Dockerfile-Swift5.3

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Build image
2+
FROM swift:5.3 as builder
3+
4+
RUN apt-get -qq update && apt-get install -y \
5+
libssl-dev zlib1g-dev \
6+
&& rm -r /var/lib/apt/lists/*
7+
WORKDIR /app
8+
COPY . .
9+
RUN mkdir -p /build/lib && cp -R /usr/lib/swift/linux/*.so* /build/lib
10+
RUN swift build -c release -Xswiftc -g && mv `swift build -c release --show-bin-path` /build/bin
11+
12+
# Run image
13+
FROM ubuntu:18.04
14+
15+
# DEBIAN_FRONTEND=noninteractive for automatic UTC configuration in tzdata
16+
RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
17+
libatomic1 libicu60 libxml2 libcurl4 libz-dev libbsd0 tzdata libcurl4-openssl-dev \
18+
&& rm -r /var/lib/apt/lists/*
19+
WORKDIR /app
20+
COPY --from=builder /build/bin/Run .
21+
COPY --from=builder /build/lib/* /usr/lib/
22+
COPY --from=builder /app/Public ./Public
23+
COPY --from=builder /app/Resources ./Resources
24+
EXPOSE 8080
25+
26+
ENTRYPOINT ./Run serve --env production --hostname 0.0.0.0 --port 8080

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ Currently we have the following images:
88
- `Dockerfile-Swift4` which is using Swift 4 and is supposed to be used for Vapor 2 projects. The image is pushed to [here](https://hub.docker.com/r/brettrtoomey/vapor-ci/)
99
- `Dockerfile-Swift4.1` which is using Swift 4.1 and is supposed to be used for Vapor 2 or 3 projects. The image is pushed to [here](https://hub.docker.com/r/nodesvapor/vapor-ci) with tag "swift-4.1".
1010
- `Dockerfile-Swift4.2` which is using Swift 4.2 (release) and is supposed to be used for Vapor 2 or 3 projects. The image is pushed to [here](https://hub.docker.com/r/nodesvapor/vapor-ci) with tag "swift-4.2".
11-
- `Dockerfile-Swift5` which is using Swift 5.0 and is supposed to be used for Vapor 3 or 4 projects. The image is pushed to [here](https://hub.docker.com/r/nodesvapor/vapor-ci) with tag "swift-5.0".
11+
- `Dockerfile-Swift5` which is using Swift 5.0 and is supposed to be used for Vapor 3. The image is pushed to [here](https://hub.docker.com/r/nodesvapor/vapor-ci) with tag "swift-5.0".
12+
- `Dockerfile-Swift5.1` which is using Swift 5.1 and is supposed to be used for Vapor 3. The image is pushed to [here](https://hub.docker.com/r/nodesvapor/vapor-ci) with tag "swift-5.1".
13+
- `Dockerfile-Swift5.2` which is using Swift 5.2 and is supposed to be used for Vapor 3 or 4 projects. The image is pushed to [here](https://hub.docker.com/r/nodesvapor/vapor-ci) with tag "swift-5.2".
14+
- `Dockerfile-Swift5.3` which is using Swift 5.3 and is supposed to be used for Vapor 3 or 4 projects. The image is pushed to [here](https://hub.docker.com/r/nodesvapor/vapor-ci) with tag "swift-5.3".
1215

1316
## 🛠 Updating the Docker images
1417

@@ -20,7 +23,8 @@ To make it easier to run a Vapor app through a Docker container, we have the fol
2023

2124
- `Hosting/Dockerfile-Swift4.1` which is using Swift 4.1 and is supposed to be used for Vapor 2 or Vapor 3 projects.
2225
- `Hosting/Dockerfile-Swift4.2` which is using Swift 4.2 and is supposed to be used for Vapor 2 or Vapor 3 projects.
23-
- `Hosting/Dockerfile-Swift5.0` which is using Swift 5.0 and is supposed to be used for Vapor 3 or Vapor 4 projects.
26+
- `Hosting/Dockerfile-Swift5.0` which is using Swift 5.0 and is supposed to be used for Vapor 3 projects.
27+
- `Hosting/Dockerfile-Swift5.3` which is using Swift 5.3 and is supposed to be used for Vapor 3 or Vapor 4 projects.
2428

2529
Further, we have the following Docker Compose files for spinning up full environments including database and Redis:
2630

@@ -31,7 +35,9 @@ Further, we have the following Docker Compose files for spinning up full environ
3135
To make it easier to test Vapor apps locally on Linux using Docker, we have made the following Dockerfiles:
3236

3337
- `Testing/Dockerfile-Swift4.1` which is using Swift 4.1 and is supposed to be used for Vapor 2 or Vapor 3 projects.
34-
- `Testing/Dockerfile-Swift4.2` which is using Swift 4.1 and is supposed to be used for Vapor 2 or Vapor 3 projects.
38+
- `Testing/Dockerfile-Swift4.2` which is using Swift 4.2 and is supposed to be used for Vapor 2 or Vapor 3 projects.
39+
- `Testing/Dockerfile-Swift5.0` which is using Swift 5.0 and is supposed to be used for Vapor 3 projects.
40+
- `Testing/Dockerfile-Swift5.3` which is using Swift 5.3 and is supposed to be used for Vapor 3 or Vapor 4 projects.
3541

3642
## 🌳 Environment variables
3743

Testing/Dockerfile-Swift5.3

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM swift:5.3
2+
WORKDIR /package
3+
COPY . ./
4+
5+
RUN apt-get update && apt-get install -y wget apt-transport-https software-properties-common && \
6+
wget -q https://repo.vapor.codes/apt/keyring.gpg -O- | apt-key add - && \
7+
echo "deb https://repo.vapor.codes/apt $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/vapor.list && \
8+
apt-get update && \
9+
apt-get install -y libmysqlclient20 libmysqlclient-dev cstack ctls openssl libssl-dev libcurl4-openssl-dev
10+
11+
RUN swift package resolve
12+
RUN swift package clean
13+
14+
CMD ["swift", "--version"]
15+
CMD ["swift", "test"]

0 commit comments

Comments
 (0)