mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 01:29:07 +00:00
swarmd: Modernize build
Uses the alpine base container. Networking is not disabled because we still clone at build time. No swarmd.yml update because the commit referenced here no longer exists in the upstream repo after a force push. This will change in the next commit. Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This commit is contained in:
parent
6d495fc92f
commit
5cc219cf72
@ -1,4 +1,4 @@
|
||||
FROM golang:1.7-alpine3.5 AS build
|
||||
FROM linuxkit/alpine:630ee558e4869672fae230c78364e367b8ea67a9 AS build
|
||||
|
||||
RUN \
|
||||
apk update && apk upgrade && \
|
||||
@ -6,10 +6,13 @@ RUN \
|
||||
ca-certificates \
|
||||
gcc \
|
||||
git \
|
||||
go \
|
||||
libc-dev \
|
||||
make \
|
||||
&& true
|
||||
|
||||
ENV GOPATH=/root/go
|
||||
|
||||
# PR https://github.com/docker/swarmkit/pull/1965 from ijc25/containerd
|
||||
ENV SWARMKIT_PR=1965
|
||||
ENV SWARMKIT_COMMIT=321b9c6600a9422c3245b277a1b3ae599244d4b7
|
||||
@ -23,14 +26,21 @@ RUN git checkout $SWARMKIT_COMMIT
|
||||
|
||||
RUN make binaries GO_GCFLAGS="-buildmode pie --ldflags '-extldflags \"-fno-PIC -static\"'"
|
||||
|
||||
RUN mkdir -p /build/dist/usr/bin/ /build/dist/etc
|
||||
RUN cp bin/swarmd bin/swarmctl /build/dist/usr/bin/
|
||||
RUN strip /build/dist/usr/bin/swarmd /build/dist/usr/bin/swarmctl
|
||||
RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/
|
||||
RUN apk add --no-cache --initdb -p /out \
|
||||
alpine-baselayout \
|
||||
busybox \
|
||||
ca-certificates \
|
||||
iptables \
|
||||
musl \
|
||||
util-linux
|
||||
|
||||
RUN cp -r /etc/ssl /build/dist/etc/ssl
|
||||
RUN mkdir -p /out/usr/bin/ /out/etc
|
||||
RUN cp bin/swarmd bin/swarmctl /out/usr/bin/
|
||||
RUN strip /out/usr/bin/swarmd /out/usr/bin/swarmctl
|
||||
|
||||
FROM scratch
|
||||
WORKDIR /
|
||||
ENTRYPOINT []
|
||||
COPY --from=build /build/dist /
|
||||
COPY --from=build /out /
|
||||
CMD ["/usr/bin/swarmd", "--containerd-addr=/run/containerd/containerd.sock", "--log-level=debug", "--state-dir=/var/lib/swarmd"]
|
||||
|
@ -1,6 +1,7 @@
|
||||
.PHONY: tag push
|
||||
all: push
|
||||
|
||||
ORG?=linuxkit
|
||||
IMAGE=swarmd
|
||||
|
||||
HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}')
|
||||
@ -8,7 +9,7 @@ HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}')
|
||||
default: push
|
||||
|
||||
tag: Dockerfile
|
||||
docker build -t linuxkit/$(IMAGE):$(HASH) .
|
||||
docker build --no-cache -t $(ORG)/$(IMAGE):$(HASH) .
|
||||
|
||||
push: tag
|
||||
docker pull linuxkit/$(IMAGE):$(HASH) || docker push linuxkit/$(IMAGE):$(HASH)
|
||||
docker pull $(ORG)/$(IMAGE):$(HASH) || docker push $(ORG)/$(IMAGE):$(HASH)
|
||||
|
Loading…
Reference in New Issue
Block a user