Skip to content
name: Build Docker image and push to Docker Hub
on:
release:
types: [ published ]
jobs:
build_and_push:
name: Build a new Docker image for the release (and a latest) and push it to Docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Docker
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Release tag
run: echo "${{ github.event.release.tag_name }}"
- name: Build the release Docker image
run: |
docker build --build-arg FRONTEND_TAG=${{ github.event.release.tag_name }} -t signalen/frontend:${{ github.event.release.tag_name }} .
- name: Build the latest Docker image
run: |
docker build -t signalen/frontend:latest .
- name: Push the tagged image to Docker
run: docker push signalen/frontend:${{ github.event.release.tag_name }}
- name: Push the latest image to Docker
run: docker push signalen/frontend:latest