-
Notifications
You must be signed in to change notification settings - Fork 42
/
Dockerfile
34 lines (33 loc) · 1020 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
32
33
34
ARG ALPINE=alpine:3.17.2
FROM ${ALPINE} AS verify
ARG ARCH
ARG TAG
WORKDIR /verify
ADD https://github.com/k3s-io/k3s/releases/download/${TAG}/sha256sum-${ARCH}.txt .
RUN set -x \
&& apk --no-cache add \
curl \
file
RUN if [ "${ARCH}" == "amd64" ]; then \
export ARTIFACT="k3s"; \
elif [ "${ARCH}" == "arm" ]; then \
export ARTIFACT="k3s-armhf"; \
elif [ "${ARCH}" == "arm64" ]; then \
export ARTIFACT="k3s-arm64"; \
elif [ "${ARCH}" == "s390x" ]; then \
export ARTIFACT="k3s-s390x"; \
fi \
&& curl --output ${ARTIFACT} --fail --location https://github.com/k3s-io/k3s/releases/download/${TAG}/${ARTIFACT} \
&& grep -E " k3s(-arm\w*|-s390x)?$" sha256sum-${ARCH}.txt | sha256sum -c \
&& mv -vf ${ARTIFACT} /opt/k3s \
&& chmod +x /opt/k3s \
&& file /opt/k3s
FROM ${ALPINE}
ARG ARCH
ARG TAG
RUN apk --no-cache add \
jq libselinux-utils procps
COPY --from=verify /opt/k3s /opt/k3s
COPY scripts/upgrade.sh /bin/upgrade.sh
ENTRYPOINT ["/bin/upgrade.sh"]
CMD ["upgrade"]