Skip to content

Commit 531aefd

Browse files
authored
Merge pull request #1 from wlisac/swift-5.0.1
Add Swift 5.0.1 for aarch64 and document the build process
2 parents 68c85e4 + 74594a0 commit 531aefd

File tree

9 files changed

+371
-2
lines changed

9 files changed

+371
-2
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# wlisac/aarch64-ubuntu-swift:5.0.1-bionic
2+
3+
ARG BASE_IMAGE=balenalib/aarch64-ubuntu:bionic
4+
5+
# Download and decompress the tarball into an intermediate container
6+
# to improve cache accross different base image variations
7+
8+
FROM balenalib/aarch64-ubuntu:bionic as downloader
9+
10+
LABEL Description="Swift Downloader"
11+
12+
ARG TARBALL_URL=https://github.com/futurejones/swift-arm64/releases/download/v5.0.1-RELEASE/swift-5.0.1-aarch64-RELEASE-Ubuntu-18.04_2019-05-17.tar.gz
13+
ARG TARBALL_FILE=swift.tgz
14+
15+
WORKDIR /swift
16+
17+
RUN curl -L -o $TARBALL_FILE $TARBALL_URL \
18+
&& tar -xvzf $TARBALL_FILE -C /swift \
19+
&& rm $TARBALL_FILE
20+
21+
# Create base image
22+
23+
FROM "$BASE_IMAGE"
24+
25+
LABEL maintainer "Will Lisac <will@lisac.org>"
26+
LABEL Description="Docker Container for Swift on Balena"
27+
28+
# Dependencies from official Swift Dockerfile for Swift 5.0 on Ubuntu 18.04
29+
# https://github.com/apple/swift-docker/blob/6812f217b405a5101ea3e8fce4d1cf09e3c8727b/5.0/ubuntu/18.04/Dockerfile
30+
31+
RUN install_packages \
32+
libatomic1 \
33+
libbsd0 \
34+
libcurl4 \
35+
libxml2 \
36+
libedit2 \
37+
libsqlite3-0 \
38+
libc6-dev \
39+
binutils \
40+
libgcc-5-dev \
41+
libstdc++-5-dev \
42+
libpython2.7 \
43+
tzdata \
44+
git \
45+
pkg-config
46+
47+
# Copy files from downloader to root
48+
COPY --from=downloader /swift /
49+
50+
RUN swift --version
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# wlisac/aarch64-ubuntu-swift:5.0.1-xenial
2+
3+
ARG BASE_IMAGE=balenalib/aarch64-ubuntu:xenial
4+
5+
# Download and decompress the tarball into an intermediate container
6+
# to improve cache accross different base image variations
7+
8+
FROM balenalib/aarch64-ubuntu:xenial as downloader
9+
10+
LABEL Description="Swift Downloader"
11+
12+
ARG TARBALL_URL=https://github.com/futurejones/swift-arm64/releases/download/v5.0.1-RELEASE/swift-5.0.1-aarch64-RELEASE-Ubuntu-16.04_2019-04-24.tar.gz
13+
ARG TARBALL_FILE=swift.tgz
14+
15+
WORKDIR /swift
16+
17+
RUN curl -L -o $TARBALL_FILE $TARBALL_URL \
18+
&& tar -xvzf $TARBALL_FILE -C /swift \
19+
&& rm $TARBALL_FILE
20+
21+
# Create base image
22+
23+
FROM "$BASE_IMAGE"
24+
25+
LABEL maintainer "Will Lisac <will@lisac.org>"
26+
LABEL Description="Docker Container for Swift on Balena"
27+
28+
# Dependencies from official Swift Dockerfile for Swift 5.0 on Ubuntu 16.04
29+
# https://github.com/apple/swift-docker/blob/6812f217b405a5101ea3e8fce4d1cf09e3c8727b/5.0/ubuntu/16.04/Dockerfile
30+
31+
RUN install_packages \
32+
libatomic1 \
33+
libbsd0 \
34+
libcurl3 \
35+
libxml2 \
36+
libedit2 \
37+
libsqlite3-0 \
38+
libc6-dev \
39+
binutils \
40+
libgcc-5-dev \
41+
libstdc++-5-dev \
42+
libpython2.7 \
43+
tzdata \
44+
git \
45+
pkg-config \
46+
libicu-dev
47+
48+
# Copy files from downloader to root
49+
COPY --from=downloader /swift /
50+
51+
RUN swift --version
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Autogenerated device Dockerfile based on architecture Dockerfile: wlisac/aarch64-ubuntu-swift:5.0.1-bionic
2+
3+
# wlisac/generic-aarch64-ubuntu-swift:5.0.1-bionic
4+
5+
ARG BASE_IMAGE=balenalib/generic-aarch64-ubuntu:bionic
6+
7+
# Download and decompress the tarball into an intermediate container
8+
# to improve cache accross different base image variations
9+
10+
FROM balenalib/aarch64-ubuntu:bionic as downloader
11+
12+
LABEL Description="Swift Downloader"
13+
14+
ARG TARBALL_URL=https://github.com/futurejones/swift-arm64/releases/download/v5.0.1-RELEASE/swift-5.0.1-aarch64-RELEASE-Ubuntu-18.04_2019-05-17.tar.gz
15+
ARG TARBALL_FILE=swift.tgz
16+
17+
WORKDIR /swift
18+
19+
RUN curl -L -o $TARBALL_FILE $TARBALL_URL \
20+
&& tar -xvzf $TARBALL_FILE -C /swift \
21+
&& rm $TARBALL_FILE
22+
23+
# Create base image
24+
25+
FROM "$BASE_IMAGE"
26+
27+
LABEL maintainer "Will Lisac <will@lisac.org>"
28+
LABEL Description="Docker Container for Swift on Balena"
29+
30+
# Dependencies from official Swift Dockerfile for Swift 5.0 on Ubuntu 18.04
31+
# https://github.com/apple/swift-docker/blob/6812f217b405a5101ea3e8fce4d1cf09e3c8727b/5.0/ubuntu/18.04/Dockerfile
32+
33+
RUN install_packages \
34+
libatomic1 \
35+
libbsd0 \
36+
libcurl4 \
37+
libxml2 \
38+
libedit2 \
39+
libsqlite3-0 \
40+
libc6-dev \
41+
binutils \
42+
libgcc-5-dev \
43+
libstdc++-5-dev \
44+
libpython2.7 \
45+
tzdata \
46+
git \
47+
pkg-config
48+
49+
# Copy files from downloader to root
50+
COPY --from=downloader /swift /
51+
52+
RUN swift --version
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Autogenerated device Dockerfile based on architecture Dockerfile: wlisac/aarch64-ubuntu-swift:5.0.1-xenial
2+
3+
# wlisac/generic-aarch64-ubuntu-swift:5.0.1-xenial
4+
5+
ARG BASE_IMAGE=balenalib/generic-aarch64-ubuntu:xenial
6+
7+
# Download and decompress the tarball into an intermediate container
8+
# to improve cache accross different base image variations
9+
10+
FROM balenalib/aarch64-ubuntu:xenial as downloader
11+
12+
LABEL Description="Swift Downloader"
13+
14+
ARG TARBALL_URL=https://github.com/futurejones/swift-arm64/releases/download/v5.0.1-RELEASE/swift-5.0.1-aarch64-RELEASE-Ubuntu-16.04_2019-04-24.tar.gz
15+
ARG TARBALL_FILE=swift.tgz
16+
17+
WORKDIR /swift
18+
19+
RUN curl -L -o $TARBALL_FILE $TARBALL_URL \
20+
&& tar -xvzf $TARBALL_FILE -C /swift \
21+
&& rm $TARBALL_FILE
22+
23+
# Create base image
24+
25+
FROM "$BASE_IMAGE"
26+
27+
LABEL maintainer "Will Lisac <will@lisac.org>"
28+
LABEL Description="Docker Container for Swift on Balena"
29+
30+
# Dependencies from official Swift Dockerfile for Swift 5.0 on Ubuntu 16.04
31+
# https://github.com/apple/swift-docker/blob/6812f217b405a5101ea3e8fce4d1cf09e3c8727b/5.0/ubuntu/16.04/Dockerfile
32+
33+
RUN install_packages \
34+
libatomic1 \
35+
libbsd0 \
36+
libcurl3 \
37+
libxml2 \
38+
libedit2 \
39+
libsqlite3-0 \
40+
libc6-dev \
41+
binutils \
42+
libgcc-5-dev \
43+
libstdc++-5-dev \
44+
libpython2.7 \
45+
tzdata \
46+
git \
47+
pkg-config \
48+
libicu-dev
49+
50+
# Copy files from downloader to root
51+
COPY --from=downloader /swift /
52+
53+
RUN swift --version
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Autogenerated device Dockerfile based on architecture Dockerfile: wlisac/aarch64-ubuntu-swift:5.0.1-bionic
2+
3+
# wlisac/raspberrypi3-64-ubuntu-swift:5.0.1-bionic
4+
5+
ARG BASE_IMAGE=balenalib/raspberrypi3-64-ubuntu:bionic
6+
7+
# Download and decompress the tarball into an intermediate container
8+
# to improve cache accross different base image variations
9+
10+
FROM balenalib/aarch64-ubuntu:bionic as downloader
11+
12+
LABEL Description="Swift Downloader"
13+
14+
ARG TARBALL_URL=https://github.com/futurejones/swift-arm64/releases/download/v5.0.1-RELEASE/swift-5.0.1-aarch64-RELEASE-Ubuntu-18.04_2019-05-17.tar.gz
15+
ARG TARBALL_FILE=swift.tgz
16+
17+
WORKDIR /swift
18+
19+
RUN curl -L -o $TARBALL_FILE $TARBALL_URL \
20+
&& tar -xvzf $TARBALL_FILE -C /swift \
21+
&& rm $TARBALL_FILE
22+
23+
# Create base image
24+
25+
FROM "$BASE_IMAGE"
26+
27+
LABEL maintainer "Will Lisac <will@lisac.org>"
28+
LABEL Description="Docker Container for Swift on Balena"
29+
30+
# Dependencies from official Swift Dockerfile for Swift 5.0 on Ubuntu 18.04
31+
# https://github.com/apple/swift-docker/blob/6812f217b405a5101ea3e8fce4d1cf09e3c8727b/5.0/ubuntu/18.04/Dockerfile
32+
33+
RUN install_packages \
34+
libatomic1 \
35+
libbsd0 \
36+
libcurl4 \
37+
libxml2 \
38+
libedit2 \
39+
libsqlite3-0 \
40+
libc6-dev \
41+
binutils \
42+
libgcc-5-dev \
43+
libstdc++-5-dev \
44+
libpython2.7 \
45+
tzdata \
46+
git \
47+
pkg-config
48+
49+
# Copy files from downloader to root
50+
COPY --from=downloader /swift /
51+
52+
RUN swift --version
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Autogenerated device Dockerfile based on architecture Dockerfile: wlisac/aarch64-ubuntu-swift:5.0.1-xenial
2+
3+
# wlisac/raspberrypi3-64-ubuntu-swift:5.0.1-xenial
4+
5+
ARG BASE_IMAGE=balenalib/raspberrypi3-64-ubuntu:xenial
6+
7+
# Download and decompress the tarball into an intermediate container
8+
# to improve cache accross different base image variations
9+
10+
FROM balenalib/aarch64-ubuntu:xenial as downloader
11+
12+
LABEL Description="Swift Downloader"
13+
14+
ARG TARBALL_URL=https://github.com/futurejones/swift-arm64/releases/download/v5.0.1-RELEASE/swift-5.0.1-aarch64-RELEASE-Ubuntu-16.04_2019-04-24.tar.gz
15+
ARG TARBALL_FILE=swift.tgz
16+
17+
WORKDIR /swift
18+
19+
RUN curl -L -o $TARBALL_FILE $TARBALL_URL \
20+
&& tar -xvzf $TARBALL_FILE -C /swift \
21+
&& rm $TARBALL_FILE
22+
23+
# Create base image
24+
25+
FROM "$BASE_IMAGE"
26+
27+
LABEL maintainer "Will Lisac <will@lisac.org>"
28+
LABEL Description="Docker Container for Swift on Balena"
29+
30+
# Dependencies from official Swift Dockerfile for Swift 5.0 on Ubuntu 16.04
31+
# https://github.com/apple/swift-docker/blob/6812f217b405a5101ea3e8fce4d1cf09e3c8727b/5.0/ubuntu/16.04/Dockerfile
32+
33+
RUN install_packages \
34+
libatomic1 \
35+
libbsd0 \
36+
libcurl3 \
37+
libxml2 \
38+
libedit2 \
39+
libsqlite3-0 \
40+
libc6-dev \
41+
binutils \
42+
libgcc-5-dev \
43+
libstdc++-5-dev \
44+
libpython2.7 \
45+
tzdata \
46+
git \
47+
pkg-config \
48+
libicu-dev
49+
50+
# Copy files from downloader to root
51+
COPY --from=downloader /swift /
52+
53+
RUN swift --version

Documentation/Build Process.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Build Process
2+
3+
The build / test / release process is currently pretty manual and not usable by potential contributors. This is an area of opportunity, to say the least. 😅
4+
5+
Below is an example process to add Swift 5.0.1 for aarch64 devices:
6+
7+
- Create new 5.0.1 folders in `Dockerfiles/architecture-base/aarch64/{osName}/{osVersion}` for each OS variant
8+
- Add Dockerfiles (typically these are based on previous Dockerfiles or from the official swift-docker repo)
9+
- Update Dockerfile comment (`# wlisac/aarch64-ubuntu-swift:5.0.1-xenial`) and tarball URL
10+
- Run `swift run Run build --swiftVersion 5.0.1` to build the architecture base images
11+
- Run `swift run Run test --swiftVersion 5.0.1` to test the architecture base images
12+
- Run `swift run Run generate` to generate the device base image Dockerfiles
13+
- Run `swift run Run build --swiftVersion 5.0.1` to build all of the new images
14+
- If you want to test the new device images, you can run `swift run Run test --swiftVersion 5.0.1` again
15+
- Once all of the images are built and tested, time to push: `swift run Run push --swiftVersion 5.0.1`
16+
- Run `swift run Run tag-default-images --swiftVersion 5.0.1` to tag default images (images without an OS specified)
17+
- Run `swift run Run push-default-images --swiftVersion 5.0.1` to push these default images
18+
- Commit these Dockerfiles and update readme with latest release info
19+
20+
Sometimes the build or test scripts will hang. If docker appears idle, try to stop and re-run the script.

Sources/Run/main.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,22 @@ let buildCommand = command(
5656
try builder?.buildDockerImages(filter: filter)
5757
}
5858

59+
let testCommand = command(
60+
Option("osName", default: ""),
61+
Option("osVersion", default: ""),
62+
Option("swiftVersion", default: ""),
63+
Option("baseType", default: "", description: "architecture | device"),
64+
Option("baseName", default: "", description: "architecture name | device name")
65+
) { osName, osVersion, swiftVersion, baseType, baseName in
66+
let filter = try imageDescriptionFilterFromArgs(osName: osName,
67+
osVersion: osVersion,
68+
swiftVersion: swiftVersion,
69+
baseType: baseType,
70+
baseName: baseName)
71+
builder = Builder()
72+
try builder?.testDockerImages(filter: filter)
73+
}
74+
5975
let pushCommand = command(
6076
Option("osName", default: ""),
6177
Option("osVersion", default: ""),
@@ -111,6 +127,7 @@ let pushDefaultImages = command(
111127

112128
let main = Group {
113129
$0.addCommand("build", "builds images", buildCommand)
130+
$0.addCommand("test", "tests images", testCommand)
114131
$0.addCommand("push", "push images", pushCommand)
115132
$0.addCommand("tag-default-images", "tags default device images", tagDefaultImages)
116133
$0.addCommand("push-default-images", "push default device images", pushDefaultImages)

0 commit comments

Comments
 (0)