From 37dd675f9137220aeb5c8cf141d38c84247dd400 Mon Sep 17 00:00:00 2001 From: Younes Belkada <49240599+younesbelkada@users.noreply.github.com> Date: Tue, 20 Feb 2024 03:55:53 +0100 Subject: [PATCH] ENH: [`CI` / `Docker`]: Create a workflow to temporarly build docker images in case dockerfiles are modified (#1481) * test workflow * Update Dockerfile * build docker images * Update .github/workflows/test-docker-build.yml * Update .github/workflows/test-docker-build.yml Co-authored-by: Guillaume LEGENDRE --------- Co-authored-by: Guillaume LEGENDRE --- .github/workflows/test-docker-build.yml | 42 +++++++++++++++++++++++++ docker/peft-cpu/Dockerfile | 3 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-docker-build.yml diff --git a/.github/workflows/test-docker-build.yml b/.github/workflows/test-docker-build.yml new file mode 100644 index 0000000000..d1846936f8 --- /dev/null +++ b/.github/workflows/test-docker-build.yml @@ -0,0 +1,42 @@ +name: Test Docker images (scheduled) + +on: + pull_request: + paths: + # Run only when DockerFile files are modified + - "docker/**" + +concurrency: + group: docker-image-builds + cancel-in-progress: false + +jobs: + name: "Build all modified docker images" + runs-on: ubuntu-latest + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Check out code + uses: actions/checkout@v3 + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@3f54ebb830831fc121d3263c1857cfbdc310cdb9 #v42 + with: + files: docker/** + - name: Run step if only the files listed above change + if: steps.changed-files.outputs.only_changed == 'true' + env: + CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files}} + run: | + for file in ${CHANGED_FILES}; do + echo "$file was changed" + done + - name: Build Docker images + strategy: + matrix: + docker-file: ${{ steps.changed-files.outputs.all_changed_files}} + uses: docker/build-push-action@v4 + with: + context: ${{ matrix.docker-file }} + push: False + diff --git a/docker/peft-cpu/Dockerfile b/docker/peft-cpu/Dockerfile index 48e10b8417..fe0e0bc32f 100644 --- a/docker/peft-cpu/Dockerfile +++ b/docker/peft-cpu/Dockerfile @@ -11,6 +11,7 @@ RUN apt-get update && \ apt-get clean && \ rm -rf /var/lib/apt/lists* + # Install audio-related libraries RUN apt-get update && \ apt install -y ffmpeg @@ -48,4 +49,4 @@ RUN apt-get update && \ RUN echo "source activate peft" >> ~/.profile # Activate the virtualenv -CMD ["/bin/bash"] \ No newline at end of file +CMD ["/bin/bash"]