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

WIP: Add docker files for Swift 5.3 and update documentation #12

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile-Swift5.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM swift:5.3

RUN apt-get update && apt-get install -y libmysqlclient20 libmysqlclient-dev openssl libssl-dev libcurl4-openssl-dev

CMD ["swift", "--version"]
26 changes: 26 additions & 0 deletions Hosting/Dockerfile-Swift5.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Build image
FROM swift:5.3 as builder

RUN apt-get -qq update && apt-get install -y \
libssl-dev zlib1g-dev \
&& rm -r /var/lib/apt/lists/*
WORKDIR /app
COPY . .
RUN mkdir -p /build/lib && cp -R /usr/lib/swift/linux/*.so* /build/lib
RUN swift build -c release -Xswiftc -g && mv `swift build -c release --show-bin-path` /build/bin

# Run image
FROM ubuntu:18.04

# DEBIAN_FRONTEND=noninteractive for automatic UTC configuration in tzdata
RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
libatomic1 libicu60 libxml2 libcurl4 libz-dev libbsd0 tzdata libcurl4-openssl-dev \
&& rm -r /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /build/bin/Run .
COPY --from=builder /build/lib/* /usr/lib/
COPY --from=builder /app/Public ./Public
COPY --from=builder /app/Resources ./Resources
EXPOSE 8080

ENTRYPOINT ./Run serve --env production --hostname 0.0.0.0 --port 8080
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ Currently we have the following images:
- `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/)
- `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".
- `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".
- `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".
- `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".
- `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".
- `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".
- `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".

## 🛠 Updating the Docker images

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

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

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

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

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

## 🌳 Environment variables

Expand Down
15 changes: 15 additions & 0 deletions Testing/Dockerfile-Swift5.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM swift:5.3
WORKDIR /package
COPY . ./

RUN apt-get update && apt-get install -y wget apt-transport-https software-properties-common && \
wget -q https://repo.vapor.codes/apt/keyring.gpg -O- | apt-key add - && \
echo "deb https://repo.vapor.codes/apt $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/vapor.list && \
apt-get update && \
apt-get install -y libmysqlclient20 libmysqlclient-dev cstack ctls openssl libssl-dev libcurl4-openssl-dev

RUN swift package resolve
RUN swift package clean

CMD ["swift", "--version"]
CMD ["swift", "test"]