From 1f5d88708472cb51e0476066d112cf6200b64b61 Mon Sep 17 00:00:00 2001 From: Kanishkar J Date: Mon, 15 Jun 2020 20:57:14 +0530 Subject: [PATCH 1/2] Update Makefile Signed-off-by: kanishkarj --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e13a42c..7a97123 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +VER=$(shell git rev-parse --short HEAD) + build-service: cd service && go build -a -o ./main . @@ -12,4 +14,7 @@ run-service-b: ./service/main build-img-service: - cd service && docker build -t layer5/sample-app-service:dev . + cd service && docker build -t layer5/learn-layer5:latest -t layer5/learn-layer5:$(VER) . + +image-push: + docker push layer5/learn-layer5 From 0fc3ef9e9bdaa3480eef802dd7a26badee3ca88f Mon Sep 17 00:00:00 2001 From: Kanishkar J Date: Mon, 15 Jun 2020 21:00:01 +0530 Subject: [PATCH 2/2] Create ci.yml Signed-off-by: kanishkarj --- .github/workflows/ci.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b79a4a4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: Learn Layer5 + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + docker: + name: Docker build and push + runs-on: ubuntu-latest + steps: + - name: Check out code + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') && success() + uses: actions/checkout@master + with: + fetch-depth: 1 + - name: Docker login + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') && success() + uses: azure/docker-login@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Docker build & push + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') && success() + run: | + make build-img-service + make image-push