Skip to content

Commit 29da33b

Browse files
security patch: avoid installing python in the prod image, use compiled yq (#393)
* security patch: avoid installing python in the prod image, use compiled yq * Update package version
1 parent 6e8d238 commit 29da33b

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

Dockerfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,33 @@ RUN apk --update add ca-certificates git
44

55
RUN go get github.com/github/hub
66

7+
FROM python:3.7 as yq
8+
9+
ARG YQ_VERSION=2.10.0
10+
11+
RUN pip install yq==${YQ_VERSION} && \
12+
pip install pyinstaller==3.6 && \
13+
pyinstaller --onefile /usr/local/bin/yq --dist /tmp/
14+
715
FROM codefresh/node:10.15.3-alpine3.11
816

917
RUN apk --update add --no-cache ca-certificates git curl bash yarn
1018

1119
COPY --from=go /go/bin/hub /usr/local/bin/hub
20+
COPY --from=yq /tmp/yq /usr/local/bin/yq
21+
22+
# add glibc compatibility layer for the compiled yq
23+
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
24+
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.30-r0/glibc-2.30-r0.apk && \
25+
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.30-r0/glibc-bin-2.30-r0.apk && \
26+
apk add glibc-2.30-r0.apk glibc-bin-2.30-r0.apk && \
27+
rm /etc/apk/keys/sgerrand.rsa.pub
1228

1329
ARG JQ_VERSION=1.6
14-
ARG YQ_VERSION=2.4.1
1530

1631
RUN wget -O /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 && \
1732
chmod +x /usr/local/bin/*
1833

19-
RUN apk add py-pip && pip install yq
2034
WORKDIR /cf-cli
2135

2236
COPY package.json /cf-cli

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.41.1",
3+
"version": "0.41.11",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)