|
| 1 | +# |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | +# contributor license agreements. See the NOTICE file distributed with |
| 4 | +# this work for additional information regarding copyright ownership. |
| 5 | +# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | +# (the "License"); you may not use this file except in compliance with |
| 7 | +# the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# |
| 17 | + |
| 18 | +# build go proxy from source |
| 19 | +FROM golang:1.18 AS builder_source |
| 20 | +ARG GO_PROXY_GITHUB_USER=apache |
| 21 | +ARG GO_PROXY_GITHUB_BRANCH=master |
| 22 | +RUN git clone --branch ${GO_PROXY_GITHUB_BRANCH} \ |
| 23 | + https://github.com/${GO_PROXY_GITHUB_USER}/openwhisk-runtime-go /src ;\ |
| 24 | + cd /src ; env GO111MODULE=on CGO_ENABLED=0 go build main/proxy.go && \ |
| 25 | + mv proxy /bin/proxy |
| 26 | + |
| 27 | +# or build it from a release |
| 28 | +FROM golang:1.18 AS builder_release |
| 29 | +ARG GO_PROXY_RELEASE_VERSION=1.18@1.19.0 |
| 30 | +RUN curl -sL \ |
| 31 | + https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\ |
| 32 | + | tar xzf -\ |
| 33 | + && cd openwhisk-runtime-go-*/main\ |
| 34 | + && GO111MODULE=on go build -o /bin/proxy |
| 35 | + |
| 36 | +FROM python:3.10-buster |
| 37 | + |
| 38 | +# select the builder to use |
| 39 | +ARG GO_PROXY_BUILD_FROM=release |
| 40 | + |
| 41 | +# install zip |
| 42 | +RUN apt-get update && apt-get install -y zip \ |
| 43 | + && rm -rf /var/lib/apt/lists/* |
| 44 | + |
| 45 | +# Install common modules for python |
| 46 | +COPY requirements_common.txt requirements_common.txt |
| 47 | +COPY requirements.txt requirements.txt |
| 48 | +RUN pip3 install --upgrade pip six wheel &&\ |
| 49 | + pip3 install --no-cache-dir -r requirements.txt |
| 50 | + |
| 51 | +RUN mkdir -p /action |
| 52 | +WORKDIR / |
| 53 | + |
| 54 | +COPY --from=builder_source /bin/proxy /bin/proxy_source |
| 55 | +COPY --from=builder_release /bin/proxy /bin/proxy_release |
| 56 | +RUN mv /bin/proxy_${GO_PROXY_BUILD_FROM} /bin/proxy |
| 57 | + |
| 58 | +ADD bin/compile /bin/compile |
| 59 | +ADD lib/launcher.py /lib/launcher.py |
| 60 | + |
| 61 | +# log initialization errors |
| 62 | +ENV OW_LOG_INIT_ERROR=1 |
| 63 | +# the launcher must wait for an ack |
| 64 | +ENV OW_WAIT_FOR_ACK=1 |
| 65 | +# using the runtime name to identify the execution environment |
| 66 | +ENV OW_EXECUTION_ENV=openwhisk/action-python-v3.10 |
| 67 | +# compiler script |
| 68 | +ENV OW_COMPILER=/bin/compile |
| 69 | + |
| 70 | +ENTRYPOINT ["/bin/proxy"] |
0 commit comments