Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow targetarch to be set by Docker buildkit #6549

Merged
merged 2 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Dockerfile.updater-core
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM ubuntu:20.04 as builder

ARG TARGETARCH=amd64
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't used in this file so I removed it.


SHELL ["/bin/bash", "-o", "pipefail", "-c"]

### SYSTEM DEPENDENCIES
Expand Down
10 changes: 0 additions & 10 deletions bin/ci-test
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,13 @@ function build() {
export CORE=dependabot/dependabot-core
export UPDATER=dependabot/dependabot-updater

# shellcheck disable=SC2034 # shellcheck isn't smart enough to realize `docker build` uses `TARGETARCH`
case "$(uname -m)"
in
amd64 | x86_64) TARGETARCH=amd64 ;;
arm64 | aarch64) TARGETARCH=arm64 ;;
*) TARGETARCH=amd64 ;;
esac

set -x
docker build \
--build-arg TARGETARCH="$TARGETARCH" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from ghcr.io/dependabot/dependabot-updater-core \
-f Dockerfile.updater-core \
-t "ghcr.io/dependabot/dependabot-updater-core" .
docker build \
--build-arg TARGETARCH="$TARGETARCH" \
--build-arg OMNIBUS_VERSION=latest \
--build-arg BUILDKIT_INLINE_CACHE=1 \
-f "$MODULE/Dockerfile" \
Expand Down
10 changes: 0 additions & 10 deletions bin/docker-dev-shell
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,8 @@ build_image() {
export BUILT_IMAGE=true
echo "$(tput setaf 2)=> building image from Dockerfile$(tput sgr0)"

local TARGETARCH;
case "$(uname -m)"
in
amd64 | x86_64) TARGETARCH=amd64 ;;
arm64 | aarch64) TARGETARCH=arm64 ;;
*) TARGETARCH=amd64 ;;
esac

docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--build-arg "TARGETARCH=${TARGETARCH}" \
--build-arg "USER_UID=$(id -u)" \
--build-arg "USER_GID=$(id -g)" \
--cache-from "ghcr.io/dependabot/dependabot-updater-core" \
Expand All @@ -62,7 +53,6 @@ build_image() {

docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--build-arg "TARGETARCH=${TARGETARCH}" \
--cache-from "ghcr.io/dependabot/dependabot-updater-$ECOSYSTEM" \
-t "dependabot/dependabot-updater-$ECOSYSTEM" \
-f "$ECOSYSTEM"/Dockerfile \
Expand Down
2 changes: 1 addition & 1 deletion elm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM ghcr.io/dependabot/dependabot-updater-core
ARG TARGETARCH=amd64
ARG TARGETARCH
# Install Elm
# This is currently amd64 only, see:
# - https://github.com/elm/compiler/issues/2007
Expand Down
2 changes: 1 addition & 1 deletion go_modules/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM ghcr.io/dependabot/dependabot-updater-core
ARG TARGETARCH=amd64
ARG TARGETARCH

USER root

Expand Down
2 changes: 1 addition & 1 deletion pub/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM ghcr.io/dependabot/dependabot-updater-core
ARG TARGETARCH=amd64
ARG TARGETARCH
# Install Dart
ENV PUB_CACHE=/opt/dart/pub-cache \
PUB_ENVIRONMENT="dependabot" \
Expand Down
10 changes: 0 additions & 10 deletions script/_common
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,9 @@ function docker_build() {
[[ -n "$SKIP_BUILD" ]] && return
ECOSYSTEM="$1"

local TARGETARCH;
case "$(uname -m)"
in
amd64 | x86_64) TARGETARCH=amd64 ;;
arm64 | aarch64) TARGETARCH=arm64 ;;
*) TARGETARCH=amd64 ;;
esac

# shellcheck disable=SC2086 # as $DOCKER_BUILD_ARGS relies on word-splitting
docker build \
$DOCKER_BUILD_ARGS \
--build-arg TARGETARCH="$TARGETARCH" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from "ghcr.io/dependabot/dependabot-updater-core" \
-t "ghcr.io/dependabot/dependabot-updater-core" \
Expand All @@ -26,7 +17,6 @@ function docker_build() {
# shellcheck disable=SC2086 # as $DOCKER_BUILD_ARGS relies on word-splitting
docker build \
$DOCKER_BUILD_ARGS \
--build-arg TARGETARCH="$TARGETARCH" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from "ghcr.io/dependabot/dependabot-updater-$ECOSYSTEM" \
-t "$LOCAL_IMAGE$ECOSYSTEM" \
Expand Down
2 changes: 1 addition & 1 deletion terraform/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM ghcr.io/dependabot/dependabot-updater-core
ARG TARGETARCH=amd64
ARG TARGETARCH
ARG TERRAFORM_VERSION=1.3.7
ARG TERRAFORM_AMD64_CHECKSUM=b8cf184dee15dfa89713fe56085313ab23db22e17284a9a27c0999c67ce3021e
ARG TERRAFORM_ARM64_CHECKSUM=5b491c555ea8a62dda551675fd9f27d369f5cdbe87608d2a7367d3da2d38ea38
Expand Down