Build and publish docker image #4
Workflow file for this run
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 docker image | |
on: | |
workflow_dispatch: | |
inputs: | |
name: | |
description: "Version" | |
default: "0.0.0" | |
jobs: | |
build-and-publish-docker-image: | |
runs-on: ubuntu-latest | |
environment: prod | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and publish docker image | |
run: | | |
pwd | |
cd ./authserver | |
pwd | |
ls -la | |
export GOIABADA_VERSION=${{ github.event.inputs.name }} | |
export GOIABADA_BUILD_DATE=$(date +%Y-%m-%d) | |
export GOIABADA_GIT_COMMIT=$(git rev-parse --short HEAD) | |
echo "GOIABADA_VERSION=${GOIABADA_VERSION}" | |
echo "GOIABADA_BUILD_DATE=${GOIABADA_BUILD_DATE}" | |
echo "GOIABADA_GIT_COMMIT=${GOIABADA_GIT_COMMIT}" | |
docker build -f ./docker/Dockerfile -t leodip/goiabada:${GOIABADA_VERSION} --build-arg version=${GOIABADA_VERSION} --build-arg buildDate=${GOIABADA_BUILD_DATE} --build-arg gitCommit=${GOIABADA_GIT_COMMIT} --no-cache . | |
docker tag leodip/goiabada:${GOIABADA_VERSION} leodip/goiabada:latest | |
docker push leodip/goiabada:${GOIABADA_VERSION} | |
docker push leodip/goiabada:latest | |
docker images |