-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
31 lines (21 loc) · 944 Bytes
/
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
FROM alpine as certs
RUN apk update && apk add ca-certificates
# use musl busybox since it's staticly compiled on all platforms
FROM busybox:musl AS busybox
# now build from scratch
FROM scratch
# Create kaniko directory with world write permission to allow non root run
RUN --mount=from=busybox,dst=/usr/ ["busybox", "sh", "-c", "mkdir -p /.dockerless && chmod 777 /.dockerless"]
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /.dockerless/ssl/certs/
COPY files/nsswitch.conf /etc/nsswitch.conf
ENV HOME /root
ENV USER root
ENV KANIKO_DIR /.dockerless
ENV PATH /usr/local/bin:/.dockerless:/.dockerless/bin
ENV SSL_CERT_DIR=/.dockerless/ssl/certs
COPY dockerless /.dockerless/dockerless
COPY --from=busybox /bin /.dockerless/bin
RUN ["/.dockerless/bin/sh", "-c", "echo 'root:x:0:0:root:/root:/.dockerless/bin/sh' > /etc/passwd && chmod 666 /etc/passwd"]
WORKDIR /
ENTRYPOINT ["/.dockerless/bin/sh", "-c"]
CMD ["sleep infinity"]