Skip to content
name: Build a Docker image and push it to Dockerhub
on:
release:
types: [ published ]
jobs:
web:
name: Build and push web
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- name: Checkout repository
uses: actions/checkout@v4
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# https://github.com/docker/login-action
- name: Log into Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# https://github.com/docker/metadata-action
- name: Extract Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKERHUB_IMAGE_NAME_WEB }}
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
target: signals-classification-web
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# https://github.com/peter-evans/dockerhub-description
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ vars.DOCKERHUB_IMAGE_NAME }}
short-description: ${{ github.event.repository.description }}
train:
name: Build and push train
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- name: Checkout repository
uses: actions/checkout@v4
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# https://github.com/docker/login-action
- name: Log into Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# https://github.com/docker/metadata-action
- name: Extract Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKERHUB_IMAGE_NAME_TRAIN }}
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
target: signals-classification-train
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# https://github.com/peter-evans/dockerhub-description
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ vars.DOCKERHUB_IMAGE_NAME }}
short-description: ${{ github.event.repository.description }}