k3s/Dockerfile.local

71 lines
2.2 KiB
Docker
Raw Normal View History

Update Kubernetes to v1.29.0+k3s1 (#9052) * Update to v1.29.0 Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * Update to v1.29.0 Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * Update go to 1.21.5 Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * update golangci-lint Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * update flannel to 0.23.0-k3s1 This update uses k3s' fork of flannel to allow the removal of multicluster cidr flag logic from the code Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * fix flannel calls Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * update cri-tools to version v1.29.0-k3s1 Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * Remove GOEXPERIMENT=nounified from arm builds Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * Skip golangci-lint Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * Fix setup logging with newer go version Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * Move logging flags to components arguments Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * add sysctl commands to the test script Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * Update scripts/test Signed-off-by: Brad Davidson <brad@oatmail.org> * disable secretsencryption tests Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> --------- Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> Signed-off-by: Brad Davidson <brad@oatmail.org> Co-authored-by: Brad Davidson <brad@oatmail.org>
2023-12-19 03:14:02 +00:00
ARG GOLANG=golang:1.21.5-alpine3.18
FROM ${GOLANG} as infra
ARG http_proxy=$http_proxy
ARG https_proxy=$https_proxy
ARG no_proxy=$no_proxy
ENV http_proxy=$http_proxy
ENV https_proxy=$https_proxy
ENV no_proxy=$no_proxy
RUN apk -U --no-cache add bash git gcc musl-dev docker vim less file curl wget ca-certificates jq linux-headers \
zlib-dev tar zip squashfs-tools npm coreutils python3 py3-pip openssl-dev libffi-dev libseccomp libseccomp-dev \
libseccomp-static make libuv-static sqlite-dev sqlite-static libselinux libselinux-dev zlib-dev zlib-static \
zstd pigz alpine-sdk binutils-gold btrfs-progs-dev btrfs-progs-static gawk yq \
&& \
if [ "$(go env GOARCH)" = "amd64" ]; then \
apk -U --no-cache add mingw-w64-gcc; \
fi
RUN python3 -m pip install awscli
# this works for both go 1.17 and 1.18
RUN GOPROXY=direct go install golang.org/x/tools/cmd/goimports@gopls/v0.11.0
RUN rm -rf /go/src /go/pkg
RUN if [ "$(go env GOARCH)" = "amd64" ]; then \
curl -sL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.51.2; \
fi
ARG SELINUX=true
ENV SELINUX $SELINUX
ENV STATIC_BUILD true
ENV SRC_DIR=/go/src/github.com/k3s-io/k3s
WORKDIR ${SRC_DIR}/
FROM infra as build
ARG SKIP_VALIDATE
COPY ./scripts/ ./scripts
COPY ./go.mod ./go.sum ./main.go ./
COPY ./manifests ./manifests
RUN mkdir -p bin dist
RUN --mount=type=cache,id=gomod,target=/go/pkg/mod \
./scripts/download
COPY ./cmd ./cmd
COPY ./pkg ./pkg
COPY ./tests ./tests
COPY ./.git ./.git
RUN --mount=type=cache,id=gomod,target=/go/pkg/mod \
--mount=type=cache,id=gobuild,target=/root/.cache/go-build \
./scripts/build
COPY ./contrib ./contrib
RUN --mount=type=cache,id=gomod,target=/go/pkg/mod \
--mount=type=cache,id=gobuild,target=/root/.cache/go-build \
./scripts/package-cli
RUN ./scripts/binary_size_check.sh
FROM scratch as result
ENV SRC_DIR=/go/src/github.com/k3s-io/k3s
COPY --from=build ${SRC_DIR}/dist /dist
COPY --from=build ${SRC_DIR}/bin /bin
COPY --from=build ${SRC_DIR}/build/out /build/out
COPY --from=build ${SRC_DIR}/build/static /build/static
COPY --from=build ${SRC_DIR}/pkg/static /pkg/static
COPY --from=build ${SRC_DIR}/pkg/deploy /pkg/deploy