Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 9b3d29f

Browse files
authored
Update to ubuntu 18.04 to continue to receive security fixes. (#84)
1 parent 7bde03d commit 9b3d29f

File tree

2 files changed

+147
-8
lines changed

2 files changed

+147
-8
lines changed

swift4.2/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# IBM Functions Swift 4.2 Runtime
22

3+
## 1.4.3
4+
Changes:
5+
- Update to ubuntu 18.04 to continue to receive security fixes.
6+
7+
Swift runtime version: [swift-4.2.4-RELEASE](https://swift.org/builds/swift-4.2.4-release/ubuntu1804/swift-4.2.4-RELEASE/swift-4.2.4-RELEASE-ubuntu18.04.tar.gz)
8+
9+
Packages included:
10+
- [Watson SDK 1.3.1](https://github.com/watson-developer-cloud/swift-sdk/releases/tag/1.3.1)
11+
12+
313
## 1.4.2
414
Changes:
515
- Update to new parent image to get latest go security fixes.

swift4.2/Dockerfile

Lines changed: 137 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,145 @@
1-
# Dockerfile extends Apache OpenWhisk Swift image https://github.com/apache/openwhisk-runtime-swift/blob/master/core/swift42Action/Dockerfile
2-
FROM openwhisk/action-swift-v4.2:8370314
1+
# Extend Apache OpenWhisk Swift v4.2 image: https://github.com/apache/openwhisk-runtime-swift/blob/master/core/swift42Action/Dockerfile
2+
FROM openwhisk/action-swift-v4.2:abb9474 AS parent_image
33

4-
# Add Pre-Installed Packages for IBM
4+
5+
# from https://github.com/apache/openwhisk-runtime-swift/blob/master/core/swift42Action/Dockerfile
6+
# Build go action-loop proxy from source.
7+
FROM golang:1.15 AS builder_source
8+
ARG GO_PROXY_GITHUB_USER=apache
9+
ARG GO_PROXY_GITHUB_BRANCH=master
10+
RUN git clone --branch ${GO_PROXY_GITHUB_BRANCH} \
11+
https://github.com/${GO_PROXY_GITHUB_USER}/openwhisk-runtime-go /src &&\
12+
cd /src && env GO111MODULE=on CGO_ENABLED=0 go build main/proxy.go && \
13+
mv proxy /bin/proxy
14+
15+
# Build go action-loop proxy from release.
16+
FROM golang:1.15 AS builder_release
17+
ARG GO_PROXY_RELEASE_VERSION=1.15@1.17.0
18+
RUN curl -sL \
19+
https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
20+
| tar xzf -\
21+
&& cd openwhisk-runtime-go-*/main\
22+
&& GO111MODULE=on go build -o /bin/proxy
23+
24+
25+
# Now start the main image.
26+
# from https://github.com/apple/swift-docker/blob/main/4.2/ubuntu/18.04/Dockerfile
27+
FROM ubuntu:18.04
28+
29+
# Upgrade to get latest security fixes, install Swift related packages and set LLVM 3.9 as the compiler.
30+
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && apt-get -q update && \
31+
# Update installed packages to get security fixes when available.
32+
apt-get upgrade -y --no-install-recommends --with-new-pkgs && \
33+
# Install swift required packages.
34+
apt-get -q install -y \
35+
make \
36+
libc6-dev \
37+
clang-3.9 \
38+
curl \
39+
libedit-dev \
40+
libpython2.7 \
41+
libicu-dev \
42+
libssl-dev \
43+
libxml2 \
44+
tzdata \
45+
git \
46+
libcurl4-openssl-dev \
47+
zlib1g-dev \
48+
pkg-config \
49+
# following packages from: https://github.com/apache/openwhisk-runtime-swift/blob/master/core/swift42Action/Dockerfile
50+
locales python3 vim \
51+
&& update-alternatives --quiet --install /usr/bin/clang clang /usr/bin/clang-3.9 100 \
52+
&& update-alternatives --quiet --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.9 100 \
53+
# from: https://github.com/apache/openwhisk-runtime-swift/blob/master/core/swift42Action/Dockerfile
54+
&& locale-gen en_US.UTF-8 \
55+
# Cleanup package lists, not required anymore.
56+
&& rm -r /var/lib/apt/lists/*
57+
58+
# Set swift variables and environment.
59+
ARG SWIFT_PLATFORM=ubuntu18.04
60+
ARG SWIFT_BRANCH=swift-4.2.4-release
61+
ARG SWIFT_VERSION=swift-4.2.4-RELEASE
62+
63+
ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
64+
SWIFT_BRANCH=$SWIFT_BRANCH \
65+
SWIFT_VERSION=$SWIFT_VERSION
66+
67+
# Download GPG keys, signature and Swift package, then unpack, cleanup and execute permissions for foundation libs.
68+
RUN SWIFT_URL=https://swift.org/builds/$SWIFT_BRANCH/$(echo "$SWIFT_PLATFORM" | tr -d .)/$SWIFT_VERSION/$SWIFT_VERSION-$SWIFT_PLATFORM.tar.gz \
69+
&& curl -fSsL $SWIFT_URL -o swift.tar.gz \
70+
&& curl -fSsL $SWIFT_URL.sig -o swift.tar.gz.sig \
71+
&& export GNUPGHOME="$(mktemp -d)" \
72+
&& set -e; \
73+
for key in \
74+
# pub rsa4096 2017-11-07 [SC] [expires: 2019-11-07]
75+
# 8513444E2DA36B7C1659AF4D7638F1FB2B2B08C4
76+
# uid [ unknown] Swift Automatic Signing Key #2 <swift-infrastructure@swift.org>
77+
8513444E2DA36B7C1659AF4D7638F1FB2B2B08C4 \
78+
# pub 4096R/91D306C6 2016-05-31 [expires: 2018-05-31]
79+
# Key fingerprint = A3BA FD35 56A5 9079 C068 94BD 63BC 1CFE 91D3 06C6
80+
# uid Swift 3.x Release Signing Key <swift-infrastructure@swift.org>
81+
A3BAFD3556A59079C06894BD63BC1CFE91D306C6 \
82+
# pub 4096R/71E1B235 2016-05-31 [expires: 2019-06-14]
83+
# Key fingerprint = 5E4D F843 FB06 5D7F 7E24 FBA2 EF54 30F0 71E1 B235
84+
# uid Swift 4.x Release Signing Key <swift-infrastructure@swift.org>
85+
5E4DF843FB065D7F7E24FBA2EF5430F071E1B235 \
86+
; do \
87+
# gpg --quiet --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
88+
gpg --quiet --keyserver keyserver.ubuntu.com --recv-keys "$key"; \
89+
done \
90+
&& gpg --batch --verify --quiet swift.tar.gz.sig swift.tar.gz \
91+
&& tar -xzf swift.tar.gz --directory / --strip-components=1 \
92+
&& rm -r "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz \
93+
&& chmod -R o+r /usr/lib/swift \
94+
# Print Installed Swift Version
95+
&& swift --version
96+
97+
98+
# from https://github.com/apache/openwhisk-runtime-swift/blob/master/core/swift42Action/Dockerfile
99+
# Select the action-loop proxy build to activate for this image (release/source).
100+
ARG GO_PROXY_BUILD_FROM=release
101+
102+
103+
# Get the /swiftAction directory from parent_image.
104+
COPY --from=parent_image /swiftAction /swiftAction
105+
106+
# Set active workdir to the action directory.
107+
WORKDIR /swiftAction
108+
109+
# Get compiled action-loop proxy from builder_source.
110+
COPY --from=builder_source /bin/proxy /bin/proxy_source
111+
# Get compiled action-loop proxy from builder_release.
112+
COPY --from=builder_release /bin/proxy /bin/proxy_release
113+
114+
# Get the compiler invocation script from parent_image.
115+
COPY --from=parent_image /bin/compile /bin/compile
116+
# Get the compile.launcher.swift from parent_image.
117+
COPY --from=parent_image /bin/compile.launcher.swift /bin/compile.launcher.swift
118+
119+
# Overwrite the default _Whisk.swift with an IBM Cloud adapted version.
5120
COPY _Whisk.swift /swiftAction/Sources/
121+
122+
# Add Pre-Installed SDK Packages for IBM Cloud.
6123
COPY Package.swift /swiftAction/
7-
RUN apt-get update \
8-
# Update installed packages to get security fixes if available.
9-
&& apt-get upgrade -y --no-install-recommends --with-new-pkgs\
10-
# Cleanup apt data, we do not need them later on.
11-
&& rm -rf /var/lib/apt/lists/* \
124+
125+
RUN \
126+
# Now choose which one is the active action-loop proxy.
127+
mv /bin/proxy_${GO_PROXY_BUILD_FROM} /bin/proxy \
128+
# Show actual proxy version in the build output.
129+
&& /bin/proxy -version \
130+
# Build dummy main.swift to have SDKs already compiled to speed up later action execution.
12131
&& swift build -c release \
132+
# Touch main.swift to force rebuild of it when compile is triggered next time (just to be sure).
13133
&& touch /swiftAction/Sources/main.swift \
134+
# Remove generated Action binary, will be generated again when action code is injected later on.
14135
&& rm /swiftAction/.build/release/Action \
15136
&& /swiftAction/buildandrecord.py
16137

138+
# Some environment vars for the action execution environment.
139+
ENV OW_COMPILER=/bin/compile \
140+
LANG="en_US.UTF-8" \
141+
LANGUAGE="en_US:en" \
142+
LC_ALL="en_US.UTF-8"
143+
144+
# Run the action-loop proxy when starting the container.
145+
ENTRYPOINT [ "/bin/proxy" ]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy