diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 867320ff19..b6e959dcd4 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -24,7 +24,25 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - uses: actions/checkout@v4 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag geth-assignment:$(date +%s) + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ secrets.DOCKERHUB_USERNAME }}/get-etherium-assignment + tags: | + type=sha,format=long + type=ref,event=branch + latest + + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max