-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.slim
149 lines (124 loc) · 5.29 KB
/
Dockerfile.slim
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
# PKCI slim (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:24+00:00
# =========================================================================
ARG VER_KANIKO=1.8.1
ARG VER_BUSYBOX=1.34.1
# == Kaniko ==
# ============
FROM gcr.io/kaniko-project/executor:v$VER_KANIKO AS kaniko
# == Busybox ==
# =============
FROM docker.io/busybox:$VER_BUSYBOX AS busybox
# == Binaries ==
# ==============
FROM docker.io/debian: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
# 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
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
# Busybox
COPY --from=busybox /bin/ ./
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"
# 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 ./
# == 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
# Environments
ENV HOME /root
ENV USER root
ENV DOCKER_CONFIG /kaniko/.docker/
WORKDIR /workspace
# Labels
ARG TIMESTAMP=2022-06-30T16:08:24+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:24+00:00
# =========================================================================