I may have been overthinking it #14
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 Run Docker Image | |
on: | |
push: | |
branches: | |
- 'ci' # Trigger on push to release branches | |
jobs: | |
build_and_run: | |
runs-on: ubuntu-latest # Use a GitHub-hosted runner | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Image name | |
run: echo IMAGE_NAME=${{ github.event.repository.name }} | tr '[A-Z]' '[a-z]' | tee -a $GITHUB_ENV | |
- name: Set Up Docker Build | |
env: | |
RELEASE_VERSION: ${{ github.ref_name }} # Extract version from branch name | |
run: | | |
echo "Building release version $RELEASE_VERSION" | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
- name: Build Docker Image | |
run: | | |
echo ${IMAGE_NAME}:${{ github.ref_name }} | |
echo IMAGE_NAME=${{ github.event.repository.name }} | tr '[A-Z]' '[a-z]' | |
# docker build . --file Dockerfile --tag $DOCKER_IMAGE_NAME:$RELEASE_VERSION | |
# - name: Run Docker Container | |
# run: | | |
# docker images | |
# #docker run --name my_running_container $DOCKER_IMAGE_NAME:$RELEASE_VERSION | |
# - name: Clean Up | |
# run: | | |
# docker rm -f my_running_container || true | |
# docker rmi $DOCKER_IMAGE_NAME:$RELEASE_VERSION || true |