containerd.installer 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh
  2. set -e
  3. # CONTAINERD_VERSION specifies the version of the containerd runtime binary
  4. # to install from the https://github.com/containerd/containerd repository.
  5. #
  6. # This version is used to build statically compiled containerd binaries, and
  7. # used for the integration tests. The distributed docker .deb and .rpm packages
  8. # depend on a separate (containerd.io) package, which may be a different version
  9. # as is specified here.
  10. #
  11. # Generally, the commit specified here should match a tagged release.
  12. #
  13. # The containerd golang package is also pinned in vendor.conf. When updating
  14. # the binary version you may also need to update the vendor version to pick up
  15. # bug fixes or new APIs, however, usually the Go packages are built from a
  16. # commit from the master branch.
  17. : "${CONTAINERD_VERSION:=v1.5.8}"
  18. install_containerd() (
  19. echo "Install containerd version $CONTAINERD_VERSION"
  20. git clone https://github.com/containerd/containerd.git "$GOPATH/src/github.com/containerd/containerd"
  21. cd "$GOPATH/src/github.com/containerd/containerd"
  22. git checkout -q "$CONTAINERD_VERSION"
  23. export BUILDTAGS='netgo osusergo static_build'
  24. export EXTRA_FLAGS=${GO_BUILDMODE}
  25. export EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"'
  26. # Reset build flags to nothing if we want a dynbinary
  27. if [ "$1" = "dynamic" ]; then
  28. export BUILDTAGS=''
  29. export EXTRA_FLAGS=''
  30. export EXTRA_LDFLAGS=''
  31. fi
  32. make
  33. install -D bin/containerd "${PREFIX}/containerd"
  34. install -D bin/containerd-shim "${PREFIX}/containerd-shim"
  35. install -D bin/containerd-shim-runc-v2 "${PREFIX}/containerd-shim-runc-v2"
  36. install -D bin/ctr "${PREFIX}/ctr"
  37. )