building edge on github runner

This commit is contained in:
Kasra Bigdeli
2020-08-15 06:59:01 -04:00
parent e90b2ee70b
commit 17e6916487
2 changed files with 73 additions and 5 deletions

34
.github/workflows/publish_edge.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Build and push the edge image
on:
push:
branches:
- master
jobs:
run-pre-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 14
- run: |
sudo mkdir /captain
npm ci
npm run build
npm run tslint
npm run formatter
sudo npm run test
build-publish-docker-hub:
needs: run-pre-checks
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_edge.sh

View File

@@ -1,6 +1,40 @@
#!/bin/sh
#!/bin/bash
docker build -t caprover/caprover-edge:latest -f dockerfile-captain.edge .
docker tag caprover/caprover-edge:latest caprover/caprover-edge:0.0.1
docker push caprover/caprover-edge:latest
docker push caprover/caprover-edge:0.0.1
# Exit early if any command fails
set -e
# Print all commands
set -x
pwd
CAPROVER_VERSION=0.0.1
IMAGE_NAME=caprover/caprover-edge
if [ ! -f ./package-lock.json ]; then
echo "package-lock.json not found!"
exit 1;
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
docker build -t $IMAGE_NAME:$CAPROVER_VERSION -t $IMAGE_NAME:latest -f dockerfile-captain.edge .
docker push $IMAGE_NAME:$CAPROVER_VERSION
docker push $IMAGE_NAME:latest