From ae2a37bd5ad9550fb166826eaf46356141c77b3a Mon Sep 17 00:00:00 2001 From: Stefan Dworschak Date: Wed, 2 Jun 2021 15:52:56 +0100 Subject: [PATCH] Adding github action --- .github/workflows/build.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..2a27f34b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,28 @@ +name: Docker Image + +on: + release: + types: + - created + # branches: [ master ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install AWS CLI + run: sudo apt-get update -y && sudo apt-get install -y awscli + + - name: Docker Login + run: AWS_DEFAULT_REGION=eu-west-1 AWS_ACCESS_KEY_ID=${{secrets.AWS_ACCESS_KEY}} AWS_SECRET_ACCESS_KEY=${{secrets.AWS_SECRET_ACCESS_KEY}} aws ecr get-login-password | docker login --username AWS --password-stdin 949266541515.dkr.ecr.eu-west-1.amazonaws.com/ci-hackathon-app + + - name: Build the Docker image + run: docker build . --file Dockerfile --tag 949266541515.dkr.ecr.eu-west-1.amazonaws.com/ci-hackathon-app:${GITHUB_REF##*/} + + - name: Push Image to AWS Regristry + run: docker push 949266541515.dkr.ecr.eu-west-1.amazonaws.com/ci-hackathon-app:${GITHUB_REF##*/}