Skip to content

Update Dockerfile

Update Dockerfile #4

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
permissions:
contents: write
packages: write
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Parse version info from tag
run: |
# GITHUB_REF is like refs/tags/v2.3.5, so strip the first 10 characters
VERSION=${GITHUB_REF:10}
MAJOR=$(echo "$VERSION" | cut -d '.' -f 1)
MINOR=$(echo "$VERSION" | cut -d '.' -f 2)
PATCH=$(echo "$VERSION" | cut -d '.' -f 3)
echo "version=$VERSION" >> $GITHUB_ENV
echo "version_major=$MAJOR" >> $GITHUB_ENV
echo "version_minor=$MINOR" >> $GITHUB_ENV
echo "version_patch=$PATCH" >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Replace uppercase with lowercase in reponame
run: |
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
echo "repo_name=$REPO_NAME" >> $GITHUB_ENV
- name: Build and Push Docker Image
run: |
IMG=ghcr.io/${{ env.repo_name }}
docker build . \
--tag $IMG:${{ env.version }} \
--tag $IMG:${{ env.version_major }}.${{ env.version_minor }}.latest \
--tag $IMG:${{ env.version_major }}.latest \
--tag $IMG:latest
docker push --all-tags $IMG
- name: Release to GitHub
uses: softprops/action-gh-release@v1