Skip to content

.github/workflows/build-on-tag.yml #15

.github/workflows/build-on-tag.yml

.github/workflows/build-on-tag.yml #15

Workflow file for this run

on:
create
env:
REGISTRY: docker.io
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ secrets.DOCKER_REPO }}
- name: Build the docker image
run: docker build . --file Dockerfile --tag gdl-cuda11:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} --build-arg GIT_TAG=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
- name: Tag the docker image
run: docker tag gdl-cuda11:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} ${{ secrets.DOCKER_REPO }}/gdl-cuda11:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
- name: Push the docker image
run: docker push ${{ secrets.DOCKER_REPO }}/gdl-cuda11:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
- name: Tag the docker image to latest
run: docker tag gdl-cuda11:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} ${{ secrets.DOCKER_REPO }}/gdl-cuda11:latest
- name: Push the docker image (latest tag)
run: docker push ${{ secrets.DOCKER_REPO }}/gdl-cuda11:latest