Skip to content

Commit

Permalink
Switch to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalgn committed Dec 13, 2023
1 parent 914bbd5 commit 38e3b47
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
#!/bin/sh

set -e

repository="autoapply/autoapply"
platforms="linux/amd64,linux/arm64"

build_docker() {
dockerfile="$1"
version="$2"
if [ -n "$version" ]; then
tag="$repository:$version"
echo "Building $dockerfile -> $tag..."
docker buildx build --platform=linux/amd64,linux/arm64 . -f "$dockerfile" -t "$tag" || exit 1
docker push "$tag" || exit 1
docker buildx build --push --platform="$platform" . -f "$dockerfile" -t "$tag"
else
echo "Building $dockerfile..."
docker buildx build --platform=linux/amd64,linux/arm64 . -f "$dockerfile" || exit 1
docker buildx build --platform="$platform" . -f "$dockerfile"
echo "Skipping docker push for ref '$REF_NAME'"
fi
}

echo "${DOCKER_PASSWORD}" |
docker login -u "${DOCKER_USERNAME}" --password-stdin || exit 1
docker login -u "${DOCKER_USERNAME}" --password-stdin

if [ "$REF_NAME" = "main" ]; then
build_docker "build/Dockerfile" "latest"
Expand Down

0 comments on commit 38e3b47

Please sign in to comment.