-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65f2fcd
commit 14d89df
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Build and push Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build-publish-docker-hub: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: azure/docker-login@v1 | ||
with: | ||
username: ${{ secrets.REGISTRY_USERNAME }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
- uses: actions/checkout@v1 | ||
- name: Build and Push Edge to DockerHub | ||
shell: bash | ||
run: ./dev-scripts/build_and_push.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
# Exit early if any command fails | ||
set -e | ||
|
||
# Print all commands | ||
set -x | ||
|
||
pwd | ||
|
||
# ensure you're not running it on local machine | ||
if [ -z "$CI" ] || [ -z "$GITHUB_REF" ]; then | ||
echo "Running on a local machine! Exiting!" | ||
exit 127 | ||
else | ||
echo "Running on CI" | ||
fi | ||
|
||
# BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
# On Github the line above does not work, instead: | ||
BRANCH=${GITHUB_REF##*/} | ||
echo "on branch $BRANCH" | ||
if [[ "$BRANCH" != "master" ]]; then | ||
echo 'Not on master branch! Aborting script!' | ||
exit 1 | ||
fi | ||
|
||
git clean -fdx . | ||
|
||
GIT_COMMIT_HASH=$(git rev-parse --short "$GITHUB_SHA") | ||
|
||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | ||
export DOCKER_CLI_EXPERIMENTAL=enabled | ||
docker buildx ls | ||
docker buildx create --name mybuilder | ||
docker buildx use mybuilder | ||
|
||
IMAGE_NAME=caprover/nginx-redirect | ||
IMAGE_VERSION=1-$GIT_COMMIT_HASH | ||
|
||
docker buildx build --platform linux/amd64,linux/arm64,linux/arm -t $IMAGE_NAME:$IMAGE_VERSION -t $IMAGE_NAME:latest -f Dockerfile --push . |