mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
binary targets do not need the dev environment
This makes the binary build targets use a minimal build env instead of having to build all the stuff needed for the full dev enviornment. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
parent
3152f94362
commit
ccb0b0a7cc
1 changed files with 25 additions and 17 deletions
42
Dockerfile
42
Dockerfile
|
@ -4,6 +4,7 @@ ARG CROSS="false"
|
||||||
ARG GO_VERSION=1.13.4
|
ARG GO_VERSION=1.13.4
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
ARG VPNKIT_DIGEST=e508a17cfacc8fd39261d5b4e397df2b953690da577e2c987a47630cd0c42f8e
|
ARG VPNKIT_DIGEST=e508a17cfacc8fd39261d5b4e397df2b953690da577e2c987a47630cd0c42f8e
|
||||||
|
ARG DOCKER_BUILDTAGS="apparmor seccomp selinux"
|
||||||
|
|
||||||
FROM golang:${GO_VERSION}-stretch AS base
|
FROM golang:${GO_VERSION}-stretch AS base
|
||||||
RUN echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
|
RUN echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
|
||||||
|
@ -111,10 +112,16 @@ ARG DEBIAN_FRONTEND
|
||||||
RUN --mount=type=cache,sharing=locked,id=moby-cross-false-aptlib,target=/var/lib/apt \
|
RUN --mount=type=cache,sharing=locked,id=moby-cross-false-aptlib,target=/var/lib/apt \
|
||||||
--mount=type=cache,sharing=locked,id=moby-cross-false-aptcache,target=/var/cache/apt \
|
--mount=type=cache,sharing=locked,id=moby-cross-false-aptcache,target=/var/cache/apt \
|
||||||
apt-get update && apt-get install -y --no-install-recommends \
|
apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
binutils-mingw-w64 \
|
||||||
|
btrfs-tools \
|
||||||
|
g++-mingw-w64-x86-64 \
|
||||||
libapparmor-dev \
|
libapparmor-dev \
|
||||||
libseccomp-dev
|
libdevmapper-dev \
|
||||||
|
libseccomp-dev \
|
||||||
|
libsystemd-dev \
|
||||||
|
libudev-dev
|
||||||
|
|
||||||
FROM --platform=linux/amd64 cross-true AS runtime-dev-cross-true
|
FROM --platform=linux/amd64 runtime-dev-cross-false AS runtime-dev-cross-true
|
||||||
ARG DEBIAN_FRONTEND
|
ARG DEBIAN_FRONTEND
|
||||||
# These crossbuild packages rely on gcc-<arch>, but this doesn't want to install
|
# These crossbuild packages rely on gcc-<arch>, but this doesn't want to install
|
||||||
# on non-amd64 systems.
|
# on non-amd64 systems.
|
||||||
|
@ -128,11 +135,7 @@ RUN --mount=type=cache,sharing=locked,id=moby-cross-true-aptlib,target=/var/lib/
|
||||||
libapparmor-dev:armhf \
|
libapparmor-dev:armhf \
|
||||||
libseccomp-dev:arm64 \
|
libseccomp-dev:arm64 \
|
||||||
libseccomp-dev:armel \
|
libseccomp-dev:armel \
|
||||||
libseccomp-dev:armhf \
|
libseccomp-dev:armhf
|
||||||
# install this arches seccomp here due to compat issues with the v0 builder
|
|
||||||
# This is as opposed to inheriting from runtime-dev-cross-false
|
|
||||||
libapparmor-dev \
|
|
||||||
libseccomp-dev
|
|
||||||
|
|
||||||
FROM runtime-dev-cross-${CROSS} AS runtime-dev
|
FROM runtime-dev-cross-${CROSS} AS runtime-dev
|
||||||
|
|
||||||
|
@ -261,19 +264,13 @@ RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \
|
||||||
apparmor \
|
apparmor \
|
||||||
aufs-tools \
|
aufs-tools \
|
||||||
bash-completion \
|
bash-completion \
|
||||||
binutils-mingw-w64 \
|
|
||||||
btrfs-tools \
|
|
||||||
bzip2 \
|
bzip2 \
|
||||||
g++-mingw-w64-x86-64 \
|
|
||||||
iptables \
|
iptables \
|
||||||
jq \
|
jq \
|
||||||
libcap2-bin \
|
libcap2-bin \
|
||||||
libdevmapper-dev \
|
|
||||||
libnet1 \
|
libnet1 \
|
||||||
libnl-3-200 \
|
libnl-3-200 \
|
||||||
libprotobuf-c1 \
|
libprotobuf-c1 \
|
||||||
libsystemd-dev \
|
|
||||||
libudev-dev \
|
|
||||||
net-tools \
|
net-tools \
|
||||||
pigz \
|
pigz \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
|
@ -304,15 +301,17 @@ COPY --from=containerd /build/ /usr/local/bin/
|
||||||
COPY --from=rootlesskit /build/ /usr/local/bin/
|
COPY --from=rootlesskit /build/ /usr/local/bin/
|
||||||
COPY --from=vpnkit /vpnkit /usr/local/bin/vpnkit.x86_64
|
COPY --from=vpnkit /vpnkit /usr/local/bin/vpnkit.x86_64
|
||||||
COPY --from=proxy /build/ /usr/local/bin/
|
COPY --from=proxy /build/ /usr/local/bin/
|
||||||
|
|
||||||
ENV PATH=/usr/local/cli:$PATH
|
ENV PATH=/usr/local/cli:$PATH
|
||||||
ENV DOCKER_BUILDTAGS apparmor seccomp selinux
|
ARG DOCKER_BUILDTAGS
|
||||||
|
ENV DOCKER_BUILDTAGS="${DOCKER_BUILDTAGS}"
|
||||||
WORKDIR /go/src/github.com/docker/docker
|
WORKDIR /go/src/github.com/docker/docker
|
||||||
VOLUME /var/lib/docker
|
VOLUME /var/lib/docker
|
||||||
# Wrap all commands in the "docker-in-docker" script to allow nested containers
|
# Wrap all commands in the "docker-in-docker" script to allow nested containers
|
||||||
ENTRYPOINT ["hack/dind"]
|
ENTRYPOINT ["hack/dind"]
|
||||||
|
|
||||||
FROM dev AS src
|
FROM runtime-dev AS src
|
||||||
|
# Make arg inheritable
|
||||||
|
WORKDIR /go/src/github.com/docker/docker
|
||||||
COPY . /go/src/github.com/docker/docker
|
COPY . /go/src/github.com/docker/docker
|
||||||
|
|
||||||
FROM src AS binary-base
|
FROM src AS binary-base
|
||||||
|
@ -326,6 +325,16 @@ ARG PRODUCT
|
||||||
ENV PRODUCT=${PRODUCT}
|
ENV PRODUCT=${PRODUCT}
|
||||||
ARG DEFAULT_PRODUCT_LICENSE
|
ARG DEFAULT_PRODUCT_LICENSE
|
||||||
ENV DEFAULT_PRODUCT_LICENSE=${DEFAULT_PRODUCT_LICENSE}
|
ENV DEFAULT_PRODUCT_LICENSE=${DEFAULT_PRODUCT_LICENSE}
|
||||||
|
ARG DOCKER_BUILDTAGS
|
||||||
|
ENV DOCKER_BUILDTAGS="${DOCKER_BUILDTAGS}"
|
||||||
|
# TODO: This is here because hack/make.sh binary copies these extras binaries
|
||||||
|
# from $PATH into the bundles dir.
|
||||||
|
# It would be nice to handle this in a different way.
|
||||||
|
COPY --from=tini /build/ /usr/local/bin/
|
||||||
|
COPY --from=runc /build/ /usr/local/bin/
|
||||||
|
COPY --from=containerd /build/ /usr/local/bin/
|
||||||
|
COPY --from=rootlesskit /build/ /usr/local/bin/
|
||||||
|
COPY --from=proxy /build/ /usr/local/bin/
|
||||||
|
|
||||||
FROM binary-base AS build-binary
|
FROM binary-base AS build-binary
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||||
|
@ -337,7 +346,6 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||||
|
|
||||||
FROM binary-base AS build-cross
|
FROM binary-base AS build-cross
|
||||||
ARG DOCKER_CROSSPLATFORMS
|
ARG DOCKER_CROSSPLATFORMS
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
||||||
hack/make.sh cross
|
hack/make.sh cross
|
||||||
|
|
||||||
FROM scratch AS binary
|
FROM scratch AS binary
|
||||||
|
|
Loading…
Reference in a new issue