CI: add condition for temp docker build #32
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: Test Build-Env Docker Image | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: master | |
paths: | |
- 'docker/**' | |
- '!**.md' | |
- '**docker-test.yml' | |
jobs: | |
build-test-env-image: | |
runs-on: ubuntu-latest | |
env: | |
SOURCE_ROOT: ${{ github.workspace }} | |
ENTRYPOINT: ${{ github.workspace }}/docker/default-entry.sh | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set variables | |
run: | | |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} | |
echo "IMAGE=ghcr.io/${OWNER_LC}/vs-fltk:build-env" >>${GITHUB_ENV} | |
- name: Install dependencies | |
run: sudo apt install -y docker-compose | |
- name: Check if Dockerfile has changed | |
run: | | |
FILES=$(git log -1 -p ./ | grep +++ | cut -d '/' -f 2-| sed -e 's|dev/null||g') | |
if echo "$FILES" | grep -qE "^(Dockerfile)$"; then | |
echo "changed=true" >> $GITHUB_ENV | |
else | |
echo "changed=false" >> $GITHUB_ENV | |
fi | |
- name: Build Docker image | |
if: ${{ env.changed == 'true' }} | |
run: docker build -t $IMAGE -f docker/Dockerfile ./docker | |
- name: Run commands in Docker container | |
run: | | |
export HOSTUID=$(id -u) | |
export HOSTGID=$(id -g) | |
docker-compose -f docker/docker-compose.yml run --rm dev |