mirror of
https://github.com/penpot/penpot.git
synced 2025-08-01 06:28:35 +02:00
✨ Simplify docker build script (#6924)
This commit is contained in:
parent
51107c3fc9
commit
b71ec4bfe0
1 changed files with 12 additions and 8 deletions
|
@ -1,14 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
set -x
|
||||
|
||||
DOCKER_CLI_EXPERIMENTAL=enabled
|
||||
IMAGE=${1:-backend}
|
||||
|
||||
OUTPUT="type=registry"
|
||||
|
||||
if [ "--local" = "$2" ]; then
|
||||
OUTPUT="type=docker"
|
||||
fi
|
||||
|
||||
ORG=${PENPOT_DOCKER_NAMESPACE:-penpotapp};
|
||||
PLATFORM=${PENPOT_BUILD_PLATFORM:-linux/amd64};
|
||||
|
||||
IMAGE=${PENPOT_BUILD_IMAGE:-backend}
|
||||
PLATFORM=${PENPOT_BUILD_PLATFORM:-linux/amd64};
|
||||
PLATFORM=${PENPOT_BUILD_PLATFORM:-linux/amd64,linux/arm64};
|
||||
VERSION=${PENPOT_BUILD_VERSION:-latest}
|
||||
|
||||
DOCKER_IMAGE="$ORG/$IMAGE";
|
||||
OPTIONS="-t $DOCKER_IMAGE:$VERSION";
|
||||
|
||||
|
@ -20,7 +23,7 @@ for element in "${TAGS[@]}"; do
|
|||
done
|
||||
|
||||
docker buildx inspect penpot > /dev/null 2>&1;
|
||||
docker run --privileged --rm tonistiigi/binfmt --install all
|
||||
docker run --privileged --rm tonistiigi/binfmt --install all > /dev/null;
|
||||
|
||||
if [ $? -eq 1 ]; then
|
||||
docker buildx create --name=penpot --use
|
||||
|
@ -32,4 +35,5 @@ fi
|
|||
|
||||
unset IFS;
|
||||
|
||||
docker buildx build --platform ${PLATFORM// /,} $OPTIONS -f Dockerfile.$IMAGE "$@" .;
|
||||
shift;
|
||||
docker buildx build --output $OUTPUT --platform ${PLATFORM// /,} $OPTIONS -f Dockerfile.$IMAGE .;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue