From 8407bf12505773273cf8ef6b0e19b106636fbbc4 Mon Sep 17 00:00:00 2001 From: Sven Holz Date: Tue, 21 Jun 2022 11:19:15 +0200 Subject: [PATCH] workflow added --- workflows/git2docker.yml | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 workflows/git2docker.yml diff --git a/workflows/git2docker.yml b/workflows/git2docker.yml new file mode 100644 index 0000000..34c368d --- /dev/null +++ b/workflows/git2docker.yml @@ -0,0 +1,57 @@ +# This is a basic workflow to help you get started with Actions + +name: CI to Docker Hub + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "master" branch + push: + branches: [ "master" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + + steps: + + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Check Out Repo + uses: actions/checkout@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: ./Docker_Build/ + file: ./Docker_Build/Dockerfile + push: true + tags: ${{ secrets.DOCKER_HUB_USERNAME }}/pylatemon:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} \ No newline at end of file