Skip to content

Commit

Permalink
WIP: GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
vlauciani committed Sep 11, 2024
1 parent 239e6ae commit 1c5e147
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: CI/CD

#on:
# push:
# tags:
# - 'v*.*.*'
on:
push:
branches:
- '**'
tags:
- 'v*.*.*'

env:
IMAGE_NAME: ingv/fdsnws-fetcher
Expand All @@ -25,12 +27,15 @@ jobs:
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build Docker image
run: |
docker build --no-cache --pull --tag ${{ env.IMAGE_NAME }}:latest .
- name: Save Docker image to file
run: |
docker save -o image.tar ${{ env.IMAGE_NAME }}
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: false
tags: ${{ env.IMAGE_NAME }}:latest
#platforms: linux/amd64,linux/arm64
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=/tmp/image.tar

- name: Upload Docker image
uses: actions/upload-artifact@v4
Expand All @@ -48,6 +53,7 @@ jobs:
publish-tag-and-latest:
needs: build
runs-on: ubuntu-latest
#if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download Docker image
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -77,9 +83,9 @@ jobs:
run: |
#IMAGE_TAG=${GITHUB_REF#refs/tags/v}
IMAGE_TAG="tmp"
docker tag $IMAGE_NAME:latest $IMAGE_NAME:$IMAGE_TAG
#docker push $IMAGE_NAME:latest
docker push $IMAGE_NAME:$IMAGE_TAG
docker tag ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:$IMAGE_TAG
#docker push ${{ env.IMAGE_NAME }}:latest
docker push ${{ env.IMAGE_NAME }}:$IMAGE_TAG
- name: Publish Docker description (README.md) to Docker Hub
run: |
Expand Down

0 comments on commit 1c5e147

Please sign in to comment.