diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..538d407 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,58 @@ +name: docker + +on: + push: + branches: [ master ] + tags: [ 'v*' ] + pull_request: + branches: [ master ] + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +env: + DOCKER_PUBLISH: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + + - name: Disable docker publishing if in PR build + if: ${{ github.event_name == 'pull_request' }} + run: echo "Docker publishing in PR is disabled" + env: + DOCKER_PUBLISH: false + + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push docker image + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile + push: ${{ env.DOCKER_PUBLISH }} + tags: okmo/renode:latest + cache-from: type=registry,ref=okmo/renode:renodecache + cache-to: type=registry,ref=okmo/renode:renodecache,mode=max + + - name: Build and push min renode image + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile.min + push: ${{ env.DOCKER_PUBLISH }} + tags: okmo/renodemin:latest + cache-from: type=registry,ref=okmo/renodemin:renodemincache + cache-to: type=registry,ref=okmo/renodemin:renodemincache,mode=max \ No newline at end of file