Build and publish latest Docker image #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and publish latest Docker image | |
on: | |
# Trigger the workflow on push or pull request, | |
# for the develop branch and all new tags | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: get env variables for GIT related info | |
run: | | |
echo "GIT_COMMIT_SHA=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV | |
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV | |
echo "GIT_BRANCH=$(echo $GITHUB_REF | sed 's/refs\/heads\///')" >> $GITHUB_ENV | |
echo "GIT_REMOTE=$(git config --get remote.origin.url)" >> $GITHUB_ENV | |
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
#- name: Set up QEMU | |
# uses: docker/setup-qemu-action@v3 | |
#- name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
tags: impresso/impresso-datalab:latest | |
build-args: | | |
VERSION=latest | |
GIT_REVISION=${{ env.GIT_COMMIT_SHA }} | |
BUILD_DATE=${{ env.BUILD_DATE }} | |
GIT_BRANCH=${{ env.GIT_BRANCH }} | |
GIT_REPO=${{ env.GIT_REMOTE }} | |
GIT_TAG=${{ env.GIT_TAG }} | |
GIT_BUILD_TAG=${{ env.GIT_TAG }} |