Skip to content

tls port config (#28) #94

tls port config (#28)

tls port config (#28) #94

name: Docker Build and Push to CR
on:
workflow_dispatch:
inputs:
GIT_REPO_FULL_NAME:
description: Select RepoName
required: false
type: choice
options:
- ohdsi/trex
- data2evidence/trex
GIT_BRANCH_NAME:
default: develop
description: Enter BranchName / ReleaseTagName
required: true
type: string
tag:
description: Enter tag for Image
required: true
type: string
push:
branches:
- develop
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
env:
GIT_BRANCH_NAME: ${{ github.event.inputs.GIT_BRANCH_NAME || github.head_ref || github.ref_name }} # workflow_dispatch || pull_request || push
GIT_REPO_FULL_NAME: ${{ github.event.inputs.GIT_REPO_FULL_NAME || github.event.pull_request.head.repo.full_name || github.event.repository.full_name }} # workflow_dispatch || pull_request || push
jobs:
build-push-image:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- AZ_REGISTRY_REPOSITORY: d2e-trex-base
context: .
dockerfile: ./Dockerfile.trex
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- name: Check out repository code
uses: actions/checkout@v4
with:
ref: ${{ env.GIT_BRANCH_NAME }}
repository: ${{ env.GIT_REPO_FULL_NAME }}
- name: Setting up variables
id: setup
run: |
DOCKER_BUILD_PUSH_BOOL_STR=false
if [[ ${{ github.event_name }} == "push" || ${{ github.event_name }} == "workflow_dispatch" ]]; then
DOCKER_BUILD_PUSH_BOOL_STR=true
fi
if [[ ${{ github.event_name }} == "workflow_dispatch" ]]; then
DOCKER_IMG_TAG_NAME=${{ github.event.inputs.tag }}
elif [[ ${{ github.event_name }} == "push" ]]; then
DOCKER_IMG_TAG_NAME=${{ github.ref_name }}
else
DOCKER_IMG_TAG_NAME=$(echo $(git rev-parse --short HEAD))
fi
echo GIT_BRANCH_NAME=$GIT_BRANCH_NAME >> $GITHUB_OUTPUT
echo DOCKER_IMG_TAG_NAME=$DOCKER_IMG_TAG_NAME >> $GITHUB_OUTPUT
echo DOCKER_BUILD_PUSH_BOOL_STR="${DOCKER_BUILD_PUSH_BOOL_STR}" >> $GITHUB_OUTPUT
REPO_OWNER="${{ github.repository_owner }}"
echo REPO_OWNER_LOWER=${REPO_OWNER,,} >> $GITHUB_OUTPUT
- name: "Login to GitHub Container Registry"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build and Push
id: build-push2
uses: docker/build-push-action@v6
with:
push: ${{ steps.setup.outputs.DOCKER_BUILD_PUSH_BOOL_STR }}
platforms: "linux/amd64"
tags: ghcr.io/${{ steps.setup.outputs.REPO_OWNER_LOWER }}/${{ matrix.AZ_REGISTRY_REPOSITORY }}:${{ steps.setup.outputs.DOCKER_IMG_TAG_NAME }}
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
# - name: delete-untagged-images
# if: env.GIT_BRANCH_NAME == 'develop'
# continue-on-error: true
# uses: actions/delete-package-versions@v5
# with:
# package-name: "d2e-trex-base"
# package-type: "container"
# min-versions-to-keep: 3
# delete-only-untagged-versions: "true"
- name: npm install
run: npm install
#- name: Generate dotenv
# run: npm run init:d2e
#- name: DC up
# run: npm run start:d2e
#- name: stop
# if: success() || failure()
# run: npm run stop:d2e
#- name: logs
# if: success() || failure()
# run: npm run logs:d2e
- name: Output Summary
run: |
echo "### Output summary 🚀" >> $GITHUB_STEP_SUMMARY
echo "Job Status: ${{ job.status }} " >> $GITHUB_STEP_SUMMARY
echo "GIT_BRANCH_NAME: ${{ env.GIT_BRANCH_NAME }} " >> $GITHUB_STEP_SUMMARY
echo "GIT_COMMIT_ARG: ${{ github.sha }} " >> $GITHUB_STEP_SUMMARY
echo "AZ_REGISTRY_REPOSITORY: ${{ matrix.AZ_REGISTRY_REPOSITORY }} " >> $GITHUB_STEP_SUMMARY
echo "DOCKER_BUILD_PUSH_BOOL_STR: ${{ steps.setup.outputs.DOCKER_BUILD_PUSH_BOOL_STR }} " >> $GITHUB_STEP_SUMMARY
echo "DOCKER_IMG_TAG_NAME: ${{ steps.setup.outputs.DOCKER_IMG_TAG_NAME }} " >> $GITHUB_STEP_SUMMARY