Files
linuxkit/pkg/containerd/Dockerfile
Ian Campbell 5833d1b6bc init: replace ctr with a custom client using the containerd client library
Currently it supports only `service start <SERVICE>`, but it could grow e.g.
`stop`, `exec` etc in the future (although you can still use `ctr` for those).

In order to be able to use go-compile.sh the containerd build needs to move
from /root/go to /go as the GOPATH.

The vendoring situation is not ideal, but since this tool wants to be an exact
match for the containerd it seems tollerable to reuse its vendoring.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-06-16 11:48:53 +01:00

34 lines
1.1 KiB
Docker

FROM linuxkit/alpine:7cf5393e04fe0e26e9fa8f507379cacb64595918 as alpine
RUN \
apk add \
btrfs-progs-dev \
gcc \
git \
go \
libc-dev \
linux-headers \
make \
&& true
ENV GOPATH=/go PATH=$PATH:/go/bin
ENV CONTAINERD_COMMIT=bdf9f5f7388e8203e63a74b89800f7f3dd4a7743
RUN mkdir -p $GOPATH/src/github.com/containerd && \
cd $GOPATH/src/github.com/containerd && \
git clone https://github.com/containerd/containerd.git
WORKDIR $GOPATH/src/github.com/containerd/containerd
RUN git checkout $CONTAINERD_COMMIT
RUN make binaries EXTRA_FLAGS="-buildmode pie" EXTRA_LDFLAGS="-extldflags \\\"-fno-PIC -static\\\""
RUN cp bin/containerd bin/ctr bin/containerd-shim bin/dist /usr/bin/
ADD cmd /go/src/cmd
RUN cd /go/src/cmd/service && ./skanky-vendor.sh $GOPATH/src/github.com/containerd/containerd
RUN go-compile.sh /go/src/cmd/service
WORKDIR /
COPY . .
FROM scratch
ENTRYPOINT []
WORKDIR /
COPY --from=alpine /usr/bin/containerd /usr/bin/ctr /usr/bin/dist /usr/bin/containerd-shim /go/bin/service /usr/bin/
COPY --from=alpine /etc/containerd/config.toml /etc/containerd/