Skip to content

Commit

Permalink
Use build args to override binary commits in dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Justen Martin <jmart@the-coder.com>
  • Loading branch information
jmartin84 committed Oct 10, 2019
1 parent 6f069f1 commit 095ca77
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 10 deletions.
12 changes: 12 additions & 0 deletions Dockerfile
Expand Up @@ -138,6 +138,7 @@ FROM runtime-dev-cross-${CROSS} AS runtime-dev

FROM base AS tomlv
ENV INSTALL_BINARY_NAME=tomlv
ARG TOMLV_COMMIT
COPY hack/dockerfile/install/install.sh ./install.sh
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN --mount=type=cache,target=/root/.cache/go-build \
Expand All @@ -146,6 +147,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \

FROM base AS vndr
ENV INSTALL_BINARY_NAME=vndr
ARG VNDR_COMMIT
COPY hack/dockerfile/install/install.sh ./install.sh
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN --mount=type=cache,target=/root/.cache/go-build \
Expand All @@ -154,6 +156,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \

FROM dev-base AS containerd
ARG DEBIAN_FRONTEND
ARG CONTAINERD_COMMIT
RUN --mount=type=cache,sharing=locked,id=moby-containerd-aptlib,target=/var/lib/apt \
--mount=type=cache,sharing=locked,id=moby-containerd-aptcache,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
Expand All @@ -167,6 +170,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \

FROM dev-base AS proxy
ENV INSTALL_BINARY_NAME=proxy
ARG LIBNETWORK_COMMIT
COPY hack/dockerfile/install/install.sh ./install.sh
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN --mount=type=cache,target=/root/.cache/go-build \
Expand All @@ -175,6 +179,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \

FROM base AS golangci_lint
ENV INSTALL_BINARY_NAME=golangci_lint
ARG GOLANGCI_LINT_COMMIT
COPY hack/dockerfile/install/install.sh ./install.sh
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN --mount=type=cache,target=/root/.cache/go-build \
Expand All @@ -183,6 +188,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \

FROM base AS gotestsum
ENV INSTALL_BINARY_NAME=gotestsum
ARG GOTESTSUM_COMMIT
COPY hack/dockerfile/install/install.sh ./install.sh
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN --mount=type=cache,target=/root/.cache/go-build \
Expand All @@ -191,6 +197,8 @@ RUN --mount=type=cache,target=/root/.cache/go-build \

FROM dev-base AS dockercli
ENV INSTALL_BINARY_NAME=dockercli
ARG DOCKERCLI_CHANNEL
ARG DOCKERCLI_VERSION
COPY hack/dockerfile/install/install.sh ./install.sh
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN --mount=type=cache,target=/root/.cache/go-build \
Expand All @@ -199,6 +207,8 @@ RUN --mount=type=cache,target=/root/.cache/go-build \

FROM runtime-dev AS runc
ENV INSTALL_BINARY_NAME=runc
ARG RUNC_COMMIT
ARG RUNC_BUILDTAGS
COPY hack/dockerfile/install/install.sh ./install.sh
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN --mount=type=cache,target=/root/.cache/go-build \
Expand All @@ -207,6 +217,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \

FROM dev-base AS tini
ARG DEBIAN_FRONTEND
ARG TINI_COMMIT
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 \
apt-get update && apt-get install -y --no-install-recommends \
Expand All @@ -221,6 +232,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \

FROM dev-base AS rootlesskit
ENV INSTALL_BINARY_NAME=rootlesskit
ARG ROOTLESSKIT_COMMIT
COPY hack/dockerfile/install/install.sh ./install.sh
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN --mount=type=cache,target=/root/.cache/go-build \
Expand Down
2 changes: 1 addition & 1 deletion hack/dockerfile/install/containerd.installer
Expand Up @@ -4,7 +4,7 @@
# containerd is also pinned in vendor.conf. When updating the binary
# version you may also need to update the vendor version to pick up bug
# fixes or new APIs.
CONTAINERD_COMMIT=36cf5b690dcc00ff0f34ff7799209050c3d0c59a # v1.3.0
: ${CONTAINERD_COMMIT:=36cf5b690dcc00ff0f34ff7799209050c3d0c59a} # v1.3.0

install_containerd() {
echo "Install containerd version $CONTAINERD_COMMIT"
Expand Down
4 changes: 2 additions & 2 deletions hack/dockerfile/install/dockercli.installer
@@ -1,7 +1,7 @@
#!/bin/sh

DOCKERCLI_CHANNEL=${DOCKERCLI_CHANNEL:-stable}
DOCKERCLI_VERSION=${DOCKERCLI_VERSION:-17.06.2-ce}
: ${DOCKERCLI_CHANNEL:=stable}
: ${DOCKERCLI_VERSION:=17.06.2-ce}

install_dockercli() {
echo "Install docker/cli version $DOCKERCLI_VERSION from $DOCKERCLI_CHANNEL"
Expand Down
2 changes: 1 addition & 1 deletion hack/dockerfile/install/gotestsum.installer
@@ -1,6 +1,6 @@
#!/bin/sh

GOTESTSUM_COMMIT='v0.3.5'
: ${GOTESTSUM_COMMIT:=v0.3.5}

install_gotestsum() {
echo "Installing gotestsum version $GOTESTSUM_COMMIT"
Expand Down
2 changes: 1 addition & 1 deletion hack/dockerfile/install/proxy.installer
Expand Up @@ -3,7 +3,7 @@
# LIBNETWORK_COMMIT is used to build the docker-userland-proxy binary. When
# updating the binary version, consider updating github.com/docker/libnetwork
# in vendor.conf accordingly
LIBNETWORK_COMMIT=96bcc0dae898308ed659c5095526788a602f4726
: ${LIBNETWORK_COMMIT:=96bcc0dae898308ed659c5095526788a602f4726}

install_proxy() {
case "$1" in
Expand Down
2 changes: 1 addition & 1 deletion hack/dockerfile/install/rootlesskit.installer
@@ -1,7 +1,7 @@
#!/bin/sh

# v0.7.0
ROOTLESSKIT_COMMIT=791ac8cb209a107505cd1ca5ddf23a49913e176c
: ${ROOTLESSKIT_COMMIT:=791ac8cb209a107505cd1ca5ddf23a49913e176c}

install_rootlesskit() {
case "$1" in
Expand Down
2 changes: 1 addition & 1 deletion hack/dockerfile/install/runc.installer
Expand Up @@ -4,7 +4,7 @@
# The version of runc should match the version that is used by the containerd
# version that is used. If you need to update runc, open a pull request in
# the containerd project first, and update both after that is merged.
RUNC_COMMIT=3e425f80a8c931f88e6d94a8c831b9d5aa481657 # v1.0.0-rc8-92-g84373aaa
: ${RUNC_COMMIT:=3e425f80a8c931f88e6d94a8c831b9d5aa481657} # v1.0.0-rc8-92-g84373aaa

install_runc() {
# If using RHEL7 kernels (3.10.0 el7), disable kmem accounting/limiting
Expand Down
2 changes: 1 addition & 1 deletion hack/dockerfile/install/tini.installer
@@ -1,6 +1,6 @@
#!/bin/sh

TINI_COMMIT=fec3683b971d9c3ef73f284f176672c44b448662 # v0.18.0
: ${TINI_COMMIT:=fec3683b971d9c3ef73f284f176672c44b448662} # v0.18.0

install_tini() {
echo "Install tini version $TINI_COMMIT"
Expand Down
2 changes: 1 addition & 1 deletion hack/dockerfile/install/tomlv.installer
Expand Up @@ -2,7 +2,7 @@

# When updating TOMLV_COMMIT, consider updating github.com/BurntSushi/toml
# in vendor.conf accordingly
TOMLV_COMMIT=3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 # v0.3.1
: ${TOMLV_COMMIT:=3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005} # v0.3.1

install_tomlv() {
echo "Install tomlv version $TOMLV_COMMIT"
Expand Down
2 changes: 1 addition & 1 deletion hack/dockerfile/install/vndr.installer
@@ -1,6 +1,6 @@
#!/bin/sh

VNDR_COMMIT=f5ab8fc5fb64d66b5c6e55a0bcb58b2e92362fa0
: ${VNDR_COMMIT:=f5ab8fc5fb64d66b5c6e55a0bcb58b2e92362fa0}

install_vndr() {
echo "Install vndr version $VNDR_COMMIT"
Expand Down

0 comments on commit 095ca77

Please sign in to comment.