Skip to content

Commit 1cb95a1

Browse files
committed
unify docker image build test and push
1 parent 4a307fe commit 1cb95a1

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

.github/workflows/build_docker_images.yml

+36-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
name: Build Docker images (nightly)
1+
name: Test, build, and push Docker images
22

33
on:
4+
pull_request: # During PRs, we just check if the changes Dockerfiles can be successfully built
5+
paths:
6+
- "docker/**"
47
workflow_dispatch:
58
schedule:
69
- cron: "0 0 * * *" # every day at midnight
@@ -14,9 +17,40 @@ env:
1417
CI_SLACK_CHANNEL: ${{ secrets.CI_DOCKER_CHANNEL }}
1518

1619
jobs:
17-
build-docker-images:
20+
test-build-docker-images:
1821
runs-on: ubuntu-latest
22+
if: github.event_name == 'pull_request'
23+
steps:
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v1
26+
- name: Check out code
27+
uses: actions/checkout@v3
28+
- name: Get changed files
29+
id: changed-files
30+
uses: tj-actions/changed-files@3f54ebb830831fc121d3263c1857cfbdc310cdb9 #v42
31+
with:
32+
files: docker/**
33+
- name: Run step if only the files listed above change
34+
if: steps.changed-files.outputs.only_changed == 'true'
35+
env:
36+
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files}}
37+
run: |
38+
for file in ${CHANGED_FILES}; do
39+
echo "$file was changed"
40+
done
41+
- name: Build Docker images
42+
strategy:
43+
matrix:
44+
docker-file: ${{ steps.changed-files.outputs.all_changed_files}}
45+
uses: docker/build-push-action@v4
46+
with:
47+
context: ${{ matrix.docker-file }}
48+
push: False
1949

50+
build-and-push-docker-images:
51+
runs-on: ubuntu-latest
52+
if: github.event_name != 'pull_request'
53+
2054
permissions:
2155
contents: read
2256
packages: write

docker/diffusers-pytorch-cpu/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ RUN python3 -m pip install --no-cache-dir --upgrade pip uv==0.1.11 && \
4040
numpy \
4141
scipy \
4242
tensorboard \
43-
transformers
43+
transformers \
44+
pandas
4445

4546
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)