Skip to content

docker

docker #14

Workflow file for this run

name: Build and Push Docker Image
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-push:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Extract version
id: cargo-version
run: |
VERSION=$(grep '^version' Cargo.toml | head -n 1 | awk -F'"' '{print $2}')
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Version extracted: $VERSION"
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build image
run: docker build -t docker.io/uhryniuk/tally:${{ env.VERSION }} .
- name: Push image
run: docker push docker.io/uhryniuk/tally:${{ env.VERSION }}