Skip to content

Commit

Permalink
Merge pull request #105 from smithlabcode/temp-docker
Browse files Browse the repository at this point in the history
Temp docker
  • Loading branch information
andrewdavidsmith committed Aug 15, 2023
2 parents 9d72f03 + 09a3b1d commit c930a91
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ name: Docker image build

on:
workflow_dispatch:
branches:
- main
branches: ['master']
inputs:
build_option:
description: 'Build/push option'
Expand All @@ -49,6 +48,7 @@ on:
required: false

push:
branches: ['master']
tags:
- 'v*.*.*'

Expand All @@ -70,6 +70,13 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed to get tags information

# Copy Dockerfile in case the commit to be used does not have it
# This is to be used to build older versions that didn't have Dockerfile.
# This temporary Dockerfile should not be needed for new versions.
- name: Copy Dockerfile to Temporary File
run: |
cp Dockerfile /tmp/Dockerfile
- name: 'Get latest version'
run: |
Expand Down Expand Up @@ -136,11 +143,19 @@ jobs:
echo "IMAGE_TAGS=${{ env.IMAGE_TAGS }}" >> $GITHUB_ENV
fi
- name: 'Build Docker image (push: ${{ env.PUSH }})'
- name: Use temp.Dockerfile if Dockerfile doesn't exist
run: |
if [ -f Dockerfile ]; then
echo "DOCKERFILE=./Dockerfile" >> $GITHUB_ENV
else
echo "DOCKERFILE=/tmp/Dockerfile" >> $GITHUB_ENV
fi
- name: 'Build Docker image (push: ${{ env.PUSH }}, dockerfile: ${{ env.DOCKERFILE }})'
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
file: ${{ env.DOCKERFILE }}
push: ${{ env.PUSH }}
tags: |
${{ env.IMAGE_TAGS }}
Expand Down

0 comments on commit c930a91

Please sign in to comment.