Skip to content

Commit

Permalink
Consolidate etcd dockerfiles.
Browse files Browse the repository at this point in the history
We can consolidate by using docker build args to create the individual platform Dockerfile.

Signed-off-by: James Blair <[email protected]>
  • Loading branch information
jmhbnz committed Apr 26, 2023
1 parent 4485db3 commit ab65ee3
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 45 deletions.
3 changes: 2 additions & 1 deletion Dockerfile-release.amd64 → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM --platform=linux/amd64 gcr.io/distroless/static-debian11
ARG ARCH=amd64
FROM --platform=linux/${ARCH} gcr.io/distroless/static-debian11

ADD etcd /usr/local/bin/
ADD etcdctl /usr/local/bin/
Expand Down
13 changes: 0 additions & 13 deletions Dockerfile-release.arm64

This file was deleted.

13 changes: 0 additions & 13 deletions Dockerfile-release.ppc64le

This file was deleted.

13 changes: 0 additions & 13 deletions Dockerfile-release.s390x

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ verify-goimport:
clean:
rm -f ./codecov
rm -rf ./covdir
rm -f ./bin/Dockerfile-release*
rm -f ./bin/Dockerfile-release
rm -rf ./bin/etcd*
rm -rf ./default.etcd
rm -rf ./tests/e2e/default.etcd
Expand Down
8 changes: 4 additions & 4 deletions scripts/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ fi

ARCH=$(go env GOARCH)
VERSION="${VERSION}-${ARCH}"
DOCKERFILE="Dockerfile-release.${ARCH}"
DOCKERFILE="Dockerfile"

if [ -z "${BINARYDIR:-}" ]; then
RELEASE="etcd-${1}"-$(go env GOOS)-$(go env GOARCH)
RELEASE="etcd-${1}"-$(go env GOOS)-${ARCH}
BINARYDIR="${RELEASE}"
TARFILE="${RELEASE}.tar.gz"
TARURL="https://github.com/etcd-io/etcd/releases/download/${1}/${TARFILE}"
Expand All @@ -43,8 +43,8 @@ cat ./"${DOCKERFILE}" > "${IMAGEDIR}"/Dockerfile
if [ -z "${TAG:-}" ]; then
# Fix incorrect image "Architecture" using buildkit
# From https://stackoverflow.com/q/72144329/
DOCKER_BUILDKIT=1 docker build -t "gcr.io/etcd-development/etcd:${VERSION}" "${IMAGEDIR}"
DOCKER_BUILDKIT=1 docker build -t "quay.io/coreos/etcd:${VERSION}" "${IMAGEDIR}"
DOCKER_BUILDKIT=1 docker build --build-arg="ARCH=${ARCH}" -t "gcr.io/etcd-development/etcd:${VERSION}" "${IMAGEDIR}"
DOCKER_BUILDKIT=1 docker build --build-arg="ARCH=${ARCH}" -t "quay.io/coreos/etcd:${VERSION}" "${IMAGEDIR}"
else
docker build -t "${TAG}:${VERSION}" "${IMAGEDIR}"
fi

0 comments on commit ab65ee3

Please sign in to comment.