Skip to content

Commit 9bade10

Browse files
committed
issue-11296 - WIP - reverted Dockerfile and added Dockerfile.debug
Signed-off-by: Helber Belmiro <helber.belmiro@gmail.com>
1 parent f5ed471 commit 9bade10

File tree

2 files changed

+113
-20
lines changed

2 files changed

+113
-20
lines changed

backend/Dockerfile

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,25 @@
1313
# limitations under the License.
1414

1515
# 1. Build api server application
16-
FROM golang:1.21.7 as builder
16+
FROM golang:1.21.7-bookworm as builder
1717
RUN apt-get update && apt-get install -y cmake clang musl-dev openssl
1818
WORKDIR /go/src/github.com/kubeflow/pipelines
1919

20-
RUN GO111MODULE=on GOOS=linux GOARCH=arm64 go install github.com/go-delve/delve/cmd/dlv@latest
21-
2220
COPY ./go.mod ./
2321
COPY ./go.sum ./
24-
#COPY ./hack/install-go-licenses.sh ./hack/
22+
COPY ./hack/install-go-licenses.sh ./hack/
2523

26-
RUN GO111MODULE=on GOOS=linux GOARCH=arm64 go mod download
27-
RUN #./hack/install-go-licenses.sh
24+
RUN GO111MODULE=on go mod download
25+
RUN ./hack/install-go-licenses.sh
2826

2927
COPY . .
30-
RUN GO111MODULE=on GOOS=linux GOARCH=arm64 go build -gcflags "all=-N -l" -o /bin/apiserver backend/src/apiserver/*.go
28+
RUN GO111MODULE=on go build -o /bin/apiserver backend/src/apiserver/*.go
3129
# Check licenses and comply with license terms.
3230
# First, make sure there's no forbidden license.
33-
#RUN go-licenses check ./backend/src/apiserver
34-
#RUN go-licenses csv ./backend/src/apiserver > /tmp/licenses.csv && \
35-
# diff /tmp/licenses.csv backend/third_party_licenses/apiserver.csv && \
36-
# go-licenses save ./backend/src/apiserver --save_path /tmp/NOTICES
31+
RUN go-licenses check ./backend/src/apiserver
32+
RUN go-licenses csv ./backend/src/apiserver > /tmp/licenses.csv && \
33+
diff /tmp/licenses.csv backend/third_party_licenses/apiserver.csv && \
34+
go-licenses save ./backend/src/apiserver --save_path /tmp/NOTICES
3735

3836
# 2. Compile preloaded pipeline samples
3937
FROM python:3.9 as compiler
@@ -68,19 +66,17 @@ ARG COMMIT_SHA=unknown
6866
ENV COMMIT_SHA=${COMMIT_SHA}
6967
ARG TAG_NAME=unknown
7068
ENV TAG_NAME=${TAG_NAME}
71-
ENV LOG_LEVEL info
69+
ENV LOG_LEVEL info
7270

7371
WORKDIR /bin
7472

75-
COPY --from=builder /go/bin/dlv .
76-
7773
COPY backend/src/apiserver/config/ /config
7874
COPY --from=builder /bin/apiserver /bin/apiserver
7975

8076
# Copy licenses and notices.
81-
#COPY --from=builder /tmp/licenses.csv /third_party/licenses.csv
82-
#COPY --from=builder /tmp/NOTICES /third_party/NOTICES
83-
#COPY --from=compiler /samples/ /samples/
77+
COPY --from=builder /tmp/licenses.csv /third_party/licenses.csv
78+
COPY --from=builder /tmp/NOTICES /third_party/NOTICES
79+
COPY --from=compiler /samples/ /samples/
8480
RUN chmod +x /bin/apiserver
8581

8682
# Adding CA certificate so API server can download pipeline through URL and wget is used for liveness/readiness probe command
@@ -94,6 +90,4 @@ RUN sed -E "s#/(blob|tree)/master/#/\1/${COMMIT_SHA}/#g" -i /config/sample_confi
9490
EXPOSE 8888
9591

9692
# Start the apiserver
97-
#CMD /bin/apiserver --config=/config --sampleconfig=/config/sample_config.json -logtostderr=true --logLevel=${LOG_LEVEL}
98-
CMD ["dlv", "--headless=true", "--listen=:2345", "--api-version=2", "--accept-multiclient", "--log", "exec", "/bin/apiserver", "--", "--config=/config", "--sampleconfig=/config/sample_config.json", "-logtostderr=true", "--logLevel=info"]
99-
93+
CMD /bin/apiserver --config=/config --sampleconfig=/config/sample_config.json -logtostderr=true --logLevel=${LOG_LEVEL}

backend/Dockerfile.debug

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Copyright 2021-2022 The Kubeflow Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# 1. Build api server application
16+
FROM golang:1.21.7 as builder
17+
RUN apt-get update && apt-get install -y cmake clang musl-dev openssl
18+
WORKDIR /go/src/github.com/kubeflow/pipelines
19+
20+
RUN GO111MODULE=on GOOS=linux GOARCH=arm64 go install github.com/go-delve/delve/cmd/dlv@latest
21+
22+
COPY ./go.mod ./
23+
COPY ./go.sum ./
24+
#COPY ./hack/install-go-licenses.sh ./hack/
25+
26+
RUN GO111MODULE=on GOOS=linux GOARCH=arm64 go mod download
27+
RUN #./hack/install-go-licenses.sh
28+
29+
COPY . .
30+
RUN GO111MODULE=on GOOS=linux GOARCH=arm64 go build -gcflags "all=-N -l" -o /bin/apiserver backend/src/apiserver/*.go
31+
# Check licenses and comply with license terms.
32+
# First, make sure there's no forbidden license.
33+
#RUN go-licenses check ./backend/src/apiserver
34+
#RUN go-licenses csv ./backend/src/apiserver > /tmp/licenses.csv && \
35+
# diff /tmp/licenses.csv backend/third_party_licenses/apiserver.csv && \
36+
# go-licenses save ./backend/src/apiserver --save_path /tmp/NOTICES
37+
38+
# 2. Compile preloaded pipeline samples
39+
FROM python:3.9 as compiler
40+
RUN apt-get update -y && apt-get install --no-install-recommends -y -q default-jdk python3-setuptools python3-dev jq
41+
RUN wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py
42+
COPY backend/requirements.txt .
43+
RUN python3 -m pip install -r requirements.txt --no-cache-dir
44+
45+
# Downloading Argo CLI so that the samples are validated
46+
ENV ARGO_VERSION v3.4.17
47+
RUN curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz && \
48+
gunzip argo-linux-amd64.gz && \
49+
chmod +x argo-linux-amd64 && \
50+
mv ./argo-linux-amd64 /usr/local/bin/argo
51+
52+
WORKDIR /
53+
COPY ./samples /samples
54+
COPY backend/src/apiserver/config/sample_config.json /samples/
55+
56+
# Compiling the preloaded samples.
57+
# The default image is replaced with the GCR-hosted python image.
58+
RUN set -e; \
59+
< /samples/sample_config.json jq .[].file --raw-output | while read pipeline_yaml; do \
60+
pipeline_py="${pipeline_yaml%.yaml}"; \
61+
python3 "$pipeline_py"; \
62+
done
63+
64+
# 3. Start api web server
65+
FROM debian:stable
66+
67+
ARG COMMIT_SHA=unknown
68+
ENV COMMIT_SHA=${COMMIT_SHA}
69+
ARG TAG_NAME=unknown
70+
ENV TAG_NAME=${TAG_NAME}
71+
ENV LOG_LEVEL info
72+
73+
WORKDIR /bin
74+
75+
COPY --from=builder /go/bin/dlv .
76+
77+
COPY backend/src/apiserver/config/ /config
78+
COPY --from=builder /bin/apiserver /bin/apiserver
79+
80+
# Copy licenses and notices.
81+
#COPY --from=builder /tmp/licenses.csv /third_party/licenses.csv
82+
#COPY --from=builder /tmp/NOTICES /third_party/NOTICES
83+
#COPY --from=compiler /samples/ /samples/
84+
RUN chmod +x /bin/apiserver
85+
86+
# Adding CA certificate so API server can download pipeline through URL and wget is used for liveness/readiness probe command
87+
RUN apt-get update && apt-get install -y ca-certificates wget
88+
89+
# Pin sample doc links to the commit that built the backend image
90+
RUN sed -E "s#/(blob|tree)/master/#/\1/${COMMIT_SHA}/#g" -i /config/sample_config.json && \
91+
sed -E "s/%252Fmaster/%252F${COMMIT_SHA}/#g" -i /config/sample_config.json
92+
93+
# Expose apiserver port
94+
EXPOSE 8888
95+
96+
# Start the apiserver
97+
#CMD /bin/apiserver --config=/config --sampleconfig=/config/sample_config.json -logtostderr=true --logLevel=${LOG_LEVEL}
98+
CMD ["dlv", "--headless=true", "--listen=:2345", "--api-version=2", "--accept-multiclient", "--log", "exec", "/bin/apiserver", "--", "--config=/config", "--sampleconfig=/config/sample_config.json", "-logtostderr=true", "--logLevel=info"]
99+

0 commit comments

Comments
 (0)