Skip to content

Commit 4f14cc6

Browse files
committed
Add script to generate cross-platform Dockerfile.
1 parent b6f9d1f commit 4f14cc6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

buildx-dockerfile.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
# Create a Dockerfile suitable for a multi-platform build using buildx
4+
# See: https://docs.docker.com/buildx/working-with-buildx/
5+
6+
set -o nounset
7+
set -o errexit
8+
set -o pipefail
9+
10+
DOCKERFILE=Dockerfile
11+
DOCKERFILEX=Dockerfile-x
12+
13+
# We don't want this expression to expand.
14+
# shellcheck disable=SC2016
15+
sed 's/^FROM /FROM --platform=$TARGETPLATFORM /g' < $DOCKERFILE > $DOCKERFILEX

0 commit comments

Comments
 (0)