Skip to content

Push docker image to docker hub #2

Push docker image to docker hub

Push docker image to docker hub #2

name: Push docker image to docker hub
on:
release:
types: [created]
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Get code access
uses: actions/checkout@v3
- name: Extract version number
id: extract_version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/f1-api-node:${{ env.RELEASE_VERSION }} .
- name: Push Docker image
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/f1-api-node:${{ env.RELEASE_VERSION }}