2023-05-15 19:14:08 +00:00
|
|
|
FROM alpine:3.18 as base
|
2023-11-02 09:55:57 +00:00
|
|
|
RUN apk add -U ca-certificates tar zstd tzdata
|
2021-02-06 07:16:58 +00:00
|
|
|
COPY build/out/data.tar.zst /
|
2019-01-09 16:54:15 +00:00
|
|
|
RUN mkdir -p /image/etc/ssl/certs /image/run /image/var/run /image/tmp /image/lib/modules /image/lib/firmware && \
|
2021-02-06 07:16:58 +00:00
|
|
|
tar -xa -C /image -f /data.tar.zst && \
|
2024-03-25 22:43:48 +00:00
|
|
|
echo "root:x:0:0:root:/:/bin/sh" > /image/etc/passwd && \
|
|
|
|
echo "root:x:0:" > /image/etc/group && \
|
2019-01-09 16:54:15 +00:00
|
|
|
cp /etc/ssl/certs/ca-certificates.crt /image/etc/ssl/certs/ca-certificates.crt
|
2019-01-01 08:23:01 +00:00
|
|
|
|
2023-12-15 01:42:05 +00:00
|
|
|
FROM scratch as collect
|
|
|
|
ARG DRONE_TAG="dev"
|
2019-01-09 16:54:15 +00:00
|
|
|
COPY --from=base /image /
|
2023-11-02 09:55:57 +00:00
|
|
|
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
|
2019-11-11 22:16:18 +00:00
|
|
|
RUN mkdir -p /etc && \
|
2021-08-20 22:19:16 +00:00
|
|
|
echo 'hosts: files dns' > /etc/nsswitch.conf && \
|
2023-12-15 01:42:05 +00:00
|
|
|
echo "PRETTY_NAME=\"K3s ${DRONE_TAG}\"" > /etc/os-release && \
|
2021-08-20 22:19:16 +00:00
|
|
|
chmod 1777 /tmp
|
2023-12-15 01:42:05 +00:00
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=collect / /
|
2019-11-07 19:59:25 +00:00
|
|
|
VOLUME /var/lib/kubelet
|
2019-08-14 03:05:28 +00:00
|
|
|
VOLUME /var/lib/rancher/k3s
|
2019-01-09 16:54:15 +00:00
|
|
|
VOLUME /var/lib/cni
|
|
|
|
VOLUME /var/log
|
2019-05-03 22:03:10 +00:00
|
|
|
ENV PATH="$PATH:/bin/aux"
|
2020-12-14 22:31:08 +00:00
|
|
|
ENV CRI_CONFIG_FILE="/var/lib/rancher/k3s/agent/etc/crictl.yaml"
|
2019-01-09 16:54:15 +00:00
|
|
|
ENTRYPOINT ["/bin/k3s"]
|
|
|
|
CMD ["agent"]
|