mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-12-25 00:13:59 +00:00
This adds support for a runtime configuration file that can do: - `mkdir` to make a directory at runtime, eg in `/var` or `/tmp`, to avoid workarounds - `interface` that can create network interfaces in a container or move them - `bindNS` that can bind mount namespaces of an `onboot` container to a file so a service can be started in that namespace. It merges the `service` and `onboot` tools (in `init`) to avoid duplication. This also saves some size for eg LCOW which did not use the `onboot` code in `runc`. Signed-off-by: Justin Cormack <justin.cormack@docker.com>
42 lines
1.4 KiB
Docker
42 lines
1.4 KiB
Docker
FROM linuxkit/alpine:0fd732eb9e99c4db0953ae8de23d95de340ab847 AS build
|
|
RUN apk add --no-cache --initdb alpine-baselayout make gcc musl-dev git linux-headers
|
|
|
|
ADD usermode-helper.c ./
|
|
RUN LDFLAGS=-static CFLAGS=-Werror make usermode-helper
|
|
|
|
RUN apk add --no-cache go musl-dev
|
|
ENV GOPATH=/go PATH=$PATH:/go/bin
|
|
|
|
COPY cmd /go/src/cmd
|
|
RUN go-compile.sh /go/src/cmd/init
|
|
|
|
# checkout containerd for vendoring
|
|
ENV GOPATH=/go PATH=$PATH:/go/bin
|
|
# CONTAINERD_REPO and CONTAINERD_COMMIT are defined in linuxkit/alpine
|
|
RUN mkdir -p $GOPATH/src/github.com/containerd && \
|
|
cd $GOPATH/src/github.com/containerd && \
|
|
git clone $CONTAINERD_REPO
|
|
WORKDIR $GOPATH/src/github.com/containerd/containerd
|
|
RUN git checkout $CONTAINERD_COMMIT
|
|
|
|
RUN cd /go/src/cmd/service && ./skanky-vendor.sh $GOPATH/src/github.com/containerd/containerd
|
|
RUN go-compile.sh /go/src/cmd/service
|
|
|
|
FROM linuxkit/alpine:6ed3b299f5243acb6459b4993549c5045e4ad7f4 AS mirror
|
|
RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/
|
|
RUN apk add --no-cache --initdb -p /out alpine-baselayout busybox musl
|
|
|
|
# Remove apk residuals. We have a read-only rootfs, so apk is of no use.
|
|
RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache
|
|
|
|
FROM scratch
|
|
ENTRYPOINT []
|
|
CMD []
|
|
WORKDIR /
|
|
COPY --from=build /go/bin/init /
|
|
COPY --from=build /go/bin/service /usr/bin/
|
|
COPY --from=build usermode-helper /sbin/
|
|
COPY --from=mirror /out/ /
|
|
COPY etc etc/
|
|
COPY bin bin/
|