Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

[WIP] Embeded containerd, shim and runc #400

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
29 changes: 29 additions & 0 deletions Dockerfile.containerd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM golang:1.12.9 as build

RUN apt-get update && \
apt-get install -y btrfs-tools libseccomp-dev
RUN mkdir /output

# Build static containerd with preload plugins
COPY . /go/src/github.com/weaveworks/ignite
WORKDIR /go/src/github.com/weaveworks/ignite
RUN GO111MODULE=on go build -mod=vendor -buildmode=pie -tags "netgo osusergo static_build" -ldflags '-extldflags "-fno-PIC -static"' -o /output/containerd ./cmd/containerd

# Build static shim
RUN go get -u github.com/containerd/containerd
RUN (cd /go/src/github.com/containerd/containerd && git checkout v1.3.0-rc.0)
WORKDIR /go/src/github.com/containerd/containerd
RUN GO111MODULE=off CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' -o /output/containerd-shim ./cmd/containerd-shim
RUN GO111MODULE=off CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' -o /output/containerd-shim-runc-v1 ./cmd/containerd-shim-runc-v1

# Build static runc
RUN go get -u github.com/opencontainers/runc
RUN (cd /go/src/github.com/opencontainers/runc && git checkout v1.0.0-rc8)
RUN make EXTRA_LDFLAGS="-w -s" BUILDTAGS="apparmor seccomp" -C /go/src/github.com/opencontainers/runc static
RUN cp /go/src/github.com/opencontainers/runc/runc /output/runc

FROM scratch as artifact
COPY --from=build /output/containerd /containerd
COPY --from=build /output/containerd-shim /containerd-shim
COPY --from=build /output/containerd-shim-runc-v1 /containerd-shim-runc-v1
COPY --from=build /output/runc /runc
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,7 @@ test-docs: build-docs
serve-docs: build-docs
@echo Stating docs website on http://localhost:${DOCS_PORT}/_build/html/index.html
@docker run -i --rm -p ${DOCS_PORT}:8000 -e USER_ID=$$UID ignite-docs

containerd:
@echo Build static containerd binaries ...
@docker buildx build -f Dockerfile.containerd --output type=local,dest=$(shell pwd)/bin/amd64 .
11 changes: 11 additions & 0 deletions cmd/containerd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package main

import (
"github.com/weaveworks/ignite/pkg/containerd"
"k8s.io/klog"
)

func main() {
klog.InitFlags(nil)
containerd.Main()
}
9 changes: 7 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.12

require (
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/Microsoft/go-winio v0.4.12 // indirect
github.com/Microsoft/go-winio v0.4.14 // indirect
github.com/alessio/shellescape v0.0.0-20190409004728-b115ca0f9053 // indirect
github.com/c2h5oh/datasize v0.0.0-20171227191756-4eba002a5eae
github.com/containerd/cgroups v0.0.0-20190717030353-c4b9ac5c7601 // indirect
Expand All @@ -13,6 +13,7 @@ require (
github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02 // indirect
github.com/containerd/fifo v0.0.0-20190816180239-bda0ff6ed73c // indirect
github.com/containerd/go-cni v0.0.0-20190813230227-49fbd9b210f3
github.com/containerd/go-runc v0.0.0-20190603165425-9007c2405372 // indirect
github.com/containerd/ttrpc v0.0.0-20190613183316-1fb3814edf44 // indirect
github.com/containerd/typeurl v0.0.0-20190515163108-7312978f2987 // indirect
github.com/containernetworking/cni v0.7.1 // indirect
Expand All @@ -31,6 +32,8 @@ require (
github.com/gogo/googleapis v1.2.0 // indirect
github.com/google/uuid v1.1.1 // indirect
github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/krolaw/dhcp4 v0.0.0-20190531080455-7b64900047ae
github.com/lithammer/dedent v1.1.0
github.com/miekg/dns v1.1.14
Expand All @@ -47,6 +50,7 @@ require (
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.3
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 // indirect
github.com/urfave/cli v1.21.0 // indirect
github.com/vishvananda/netlink v1.0.0
github.com/vishvananda/netns v0.0.0-20190625233234-7109fa855b0f // indirect
github.com/weaveworks/gitops-toolkit v0.0.0-20190830163251-b6682e98e2fa
Expand All @@ -59,12 +63,13 @@ require (
gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61
gotest.tools v2.2.0+incompatible // indirect
k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719
k8s.io/klog v0.4.0
k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf
sigs.k8s.io/yaml v1.1.0
)

replace (
github.com/containerd/containerd => github.com/containerd/containerd v1.3.0-beta.2
github.com/containerd/containerd => github.com/containerd/containerd v1.3.0-rc.0
github.com/docker/distribution => github.com/docker/distribution v0.0.0-20190711223531-1fb7fffdb266
github.com/godbus/dbus => github.com/godbus/dbus v0.0.0-20181101234600-2ff6f7ffd60f
github.com/opencontainers/runtime-spec => github.com/opencontainers/runtime-spec v0.1.2-0.20190812154431-4f2ab155bbdd
Expand Down
Loading