Dockerfile: tini cross build with TARGETPLATFORM
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
5e19d7ec54
commit
f0307892ea
1 changed files with 30 additions and 9 deletions
39
Dockerfile
39
Dockerfile
|
@ -314,18 +314,39 @@ FROM runc-build AS runc-linux
|
||||||
FROM binary-dummy AS runc-windows
|
FROM binary-dummy AS runc-windows
|
||||||
FROM runc-${TARGETOS} AS runc
|
FROM runc-${TARGETOS} AS runc
|
||||||
|
|
||||||
FROM dev-base AS tini
|
# tini
|
||||||
|
FROM base AS tini-src
|
||||||
|
WORKDIR /usr/src/tini
|
||||||
|
RUN git init . && git remote add origin "https://github.com/krallin/tini.git"
|
||||||
|
# TINI_VERSION specifies the version of tini (docker-init) to build. This
|
||||||
|
# binary is used when starting containers with the `--init` option.
|
||||||
|
ARG TINI_VERSION=v0.19.0
|
||||||
|
RUN git fetch -q --depth 1 origin "${TINI_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
|
||||||
|
|
||||||
|
FROM base AS tini-build
|
||||||
|
WORKDIR /go/src/github.com/krallin/tini
|
||||||
ARG DEBIAN_FRONTEND
|
ARG DEBIAN_FRONTEND
|
||||||
ARG TINI_VERSION
|
|
||||||
RUN --mount=type=cache,sharing=locked,id=moby-tini-aptlib,target=/var/lib/apt \
|
RUN --mount=type=cache,sharing=locked,id=moby-tini-aptlib,target=/var/lib/apt \
|
||||||
--mount=type=cache,sharing=locked,id=moby-tini-aptcache,target=/var/cache/apt \
|
--mount=type=cache,sharing=locked,id=moby-tini-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 cmake
|
||||||
cmake \
|
ARG TARGETPLATFORM
|
||||||
vim-common
|
RUN --mount=type=cache,sharing=locked,id=moby-tini-aptlib,target=/var/lib/apt \
|
||||||
COPY /hack/dockerfile/install/install.sh /hack/dockerfile/install/tini.installer /
|
--mount=type=cache,sharing=locked,id=moby-tini-aptcache,target=/var/cache/apt \
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
xx-apt-get install -y --no-install-recommends \
|
||||||
--mount=type=cache,target=/go/pkg/mod \
|
gcc libc6-dev
|
||||||
PREFIX=/build /install.sh tini
|
RUN --mount=from=tini-src,src=/usr/src/tini,rw \
|
||||||
|
--mount=type=cache,target=/root/.cache/go-build,id=tini-build-$TARGETPLATFORM <<EOT
|
||||||
|
set -e
|
||||||
|
CC=$(xx-info)-gcc cmake .
|
||||||
|
make tini-static
|
||||||
|
xx-verify --static tini-static
|
||||||
|
mkdir /build
|
||||||
|
mv tini-static /build/docker-init
|
||||||
|
EOT
|
||||||
|
|
||||||
|
FROM tini-build AS tini-linux
|
||||||
|
FROM binary-dummy AS tini-windows
|
||||||
|
FROM tini-${TARGETOS} AS tini
|
||||||
|
|
||||||
FROM dev-base AS rootlesskit
|
FROM dev-base AS rootlesskit
|
||||||
ARG ROOTLESSKIT_VERSION
|
ARG ROOTLESSKIT_VERSION
|
||||||
|
|
Loading…
Reference in a new issue