-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
202 lines (171 loc) · 7.07 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# PKCI normal (UPX)
# Pumped Kaniko Container Image for Continuous Integration
# =========================================================================
#
# License: MIT
# Copyright 2022 WoozyMasta <me@woozymasta.ru>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# =========================================================================
# The file was generated automatically
# ⚠️ Do not edit it yourself before publishing changes to the project ⚠️
# Generated at: 2022-06-30T16:08:32+00:00
# =========================================================================
ARG VER_KANIKO=1.8.1
ARG VER_BUSYBOX=1.34.1
ARG VER_GO=1.18
ARG VER_COSIGN=1.9.0
ARG VER_NOTARY=0.7.0
ARG VER_OPENSSL=3.0.3
# == Kaniko ==
# ============
FROM gcr.io/kaniko-project/executor:v$VER_KANIKO AS kaniko
# == Busybox ==
# =============
FROM docker.io/busybox:$VER_BUSYBOX AS busybox
# == OpenSSL ==
# =============
FROM docker.io/ep76/openssl-static:$VER_OPENSSL AS openssl
# == Cosign ==
# =============
FROM gcr.io/projectsigstore/cosign:v$VER_COSIGN AS cosign
# == Notary-signer ==
# ===================
FROM docker.io/notary:signer-$VER_NOTARY AS notary
# == Binaries ==
# ==============
FROM docker.io/golang:$VER_GO-bullseye AS binaries
ARG VER_UPX=3.96
ARG VER_BASH=5.1.016-1.2.3
ARG VER_PUSHRM=1.8.1
ARG VER_HADOLINT=2.10.0
ARG VER_JQ=1.6
ARG VER_CURL=7.83.1
ARG VER_MDTOHTML=latest
ARG VER_OPENSSL=3.0.3
ARG VER_CRANE=0.9.0
ARG VER_TEMPLAR=0.5.1
ARG VER_TOKEI=12.1.2
# hadolint ignore=DL3008
RUN set -eux && \
apt-get update && \
apt-get install --no-install-recommends -y curl ca-certificates xz-utils && \
curl -sLo upx.tar.xz \
"https://github.com/upx/upx/releases/download/v$VER_UPX/upx-$VER_UPX-amd64_linux.tar.xz" && \
tar -xvf upx.tar.xz --strip-components=1 "upx-$VER_UPX-amd64_linux/upx" && \
chmod +x upx && \
cp upx /usr/local/bin/upx && \
rm -f upx.tar.xz
WORKDIR /kaniko
# Kaniko
RUN mkdir -p bin ssl .docker .config
COPY --from=kaniko /kaniko/executor ./executor
RUN ln -s /kaniko/executor /kaniko/bin/kaniko && \
upx --no-progress --no-color /kaniko/executor && \
upx -t --no-progress --no-color /kaniko/executor
WORKDIR /kaniko/bin
# Kaniko credential helpers
COPY --from=kaniko /kaniko/docker-credential-* ./
# Busybox
COPY --from=busybox /bin/ ./
# OpenSSL
COPY --from=openssl /usr/bin/openssl ./openssl
# Cosign
COPY --from=cosign /ko-app/cosign ./cosign
# Notary
COPY --from=notary /notary/signer/notary-signer ./notary-signer
RUN set -eux && \
curl -sLo bash \
"https://github.com/robxu9/bash-static/releases/download/$VER_BASH/bash-linux-x86_64" && \
curl -sLo hadolint \
"https://github.com/hadolint/hadolint/releases/download/v$VER_HADOLINT/hadolint-Linux-x86_64" && \
curl -sLo pushrm \
"https://github.com/christian-korneck/docker-pushrm/releases/download/v$VER_PUSHRM/docker-pushrm_linux_amd64" && \
curl -sLo jq \
"https://github.com/stedolan/jq/releases/download/jq-$VER_JQ/jq-linux64" && \
curl -sLo curl \
"https://github.com/moparisthebest/static-curl/releases/download/v$VER_CURL/curl-amd64" && \
go install github.com/gomarkdown/mdtohtml@$VER_MDTOHTML && \
mv /go/bin/mdtohtml mdtohtml && \
curl -sLo crane.tar.gz \
"https://github.com/google/go-containerregistry/releases/download/v$VER_CRANE/go-containerregistry_Linux_x86_64.tar.gz" && \
tar -xvf crane.tar.gz crane && \
rm -f crane.tar.gz && \
curl -sLo templar.tar.xz \
"https://github.com/proctorlabs/templar/releases/download/v$VER_TEMPLAR/templar-x86_64-unknown-linux-musl.tar.xz" && \
tar -xvf templar.tar.xz templar && \
rm -f templar.tar.xz && \
curl -sLo tokei.tar.gz \
"https://github.com/XAMPPRocky/tokei/releases/download/v$VER_TOKEI/tokei-x86_64-unknown-linux-musl.tar.gz" && \
tar -xvf tokei.tar.gz tokei && \
rm -f tokei.tar.gz
# hadolint ignore=DL4006,DL3059
RUN set -eux && \
chmod -cR a+x,u+w,go-w ./ && \
chown -cR 0:0 ./ && \
find ./ -executable -type f -links 1 -print0 | xargs --null -- upx --no-progress --no-color || true && \
find ./ -executable -type f -links 1 -print0 | xargs --null -- upx -t --no-progress --no-color
# SSL
WORKDIR /kaniko/ssl/certs
RUN cp /etc/ssl/certs/ca-certificates.crt ./
# OpenSSL
WORKDIR /kaniko/ssl
RUN curl -sLo openssl.cnf \
"https://raw.githubusercontent.com/openssl/openssl/openssl-$VER_OPENSSL/apps/openssl.cnf"
# == Build Image ==
# =================
FROM scratch
# Binaries
COPY --from=binaries /kaniko /kaniko
COPY /src/bin /kaniko/bin
ENV PATH /usr/local/bin:/kaniko/bin:/kaniko
# hadolint ignore=DL4005
RUN ["/kaniko/bin/sh", "-c", "set -eux && mkdir -p /bin /usr/bin && ln -s /kaniko/bin/sh /bin/sh && ln -s /kaniko/bin/bash /bin/bash && ln -s /kaniko/bin/env /usr/bin/env"]
VOLUME /kaniko
# nsswitch
COPY --from=binaries /etc/nsswitch.conf /etc/nsswitch.conf
# Certificates
ENV SSL_CERT_DIR=/kaniko/ssl/certs
ENV SSL_CERT_FILE=/kaniko/ssl/certs/ca-certificates.crt
# OpenSSL config
ENV OPENSSL_CONF=/kaniko/ssl/openssl.cnf
# Environments
ENV HOME /root
ENV USER root
ENV DOCKER_CONFIG /kaniko/.docker/
ENV DOCKER_CREDENTIAL_GCR_CONFIG /kaniko/.config/gcloud/docker_credential_gcr_config.json
WORKDIR /workspace
# Labels
ARG TIMESTAMP=2022-06-30T16:08:32+00:00
LABEL org.opencontainers.image.created="$TIMESTAMP"
LABEL org.opencontainers.image.url=ghcr.io/woozymasta/pkci:latest
LABEL org.opencontainers.image.version=latest+
LABEL org.opencontainers.image.title=PKCI
LABEL org.opencontainers.image.description="Pumped Kaniko Container Image for Continuous Integration"
LABEL org.opencontainers.image.authors="WoozyMasta <me@woozymasta.ru>"
LABEL org.opencontainers.image.documentation=https://github.com/WoozyMasta/pkci
LABEL org.opencontainers.image.revision=
LABEL org.opencontainers.image.licenses=MIT
ENTRYPOINT ["/kaniko/executor"]
# =========================================================================
# The file was generated automatically
# ⚠️ Do not edit it yourself before publishing changes to the project ⚠️
# Generated at: 2022-06-30T16:08:32+00:00
# =========================================================================