Skip to content

Instantly share code, notes, and snippets.

@XciD
Created March 2, 2023 09:34
Show Gist options
  • Save XciD/097953d686765596924b0ad348dcde4f to your computer and use it in GitHub Desktop.
Save XciD/097953d686765596924b0ad348dcde4f to your computer and use it in GitHub Desktop.
Containerd with SHA Extension
ARG GO_VERSION
ARG GO_IMAGE=golang:${GO_VERSION}
FROM $GO_IMAGE AS go
# We download the patch of this code:
# https://go-review.googlesource.com/c/go/+/353402
# implement SHA1 & SHA256 acceleration using Intel SHA extensions
# We re-compile go to make it available in further binaries build
RUN apt-get update && apt-get install patch && \
cd /usr/local/go && \
wget https://go-review.googlesource.com/changes/go~353402/revisions/3/patch -qO- | base64 -d > patch && \
patch -s -p1 < patch && \
cd src && \
go build -o /usr/local/go/bin/go cmd/go
SHELL ["/bin/bash", "-xec"]
RUN apt-get update && \
apt-get install -y git pkg-config libseccomp-dev btrfs-progs gcc libbtrfs-dev
ENV PATH=/usr/local/go/bin:$PATH
ENV GOPATH=/go
ENV CGO_ENABLED=1
WORKDIR /go/src/github.com/containerd/containerd
COPY . .
ARG RELEASE_VER
ENV VERSION=$RELEASE_VER
RUN \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
make release cri-release cri-cni-release
FROM scratch AS release
COPY --from=go /go/src/github.com/containerd/containerd/releases/ /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment