Skip to content

Commit

Permalink
unify docker image build test and push
Browse files Browse the repository at this point in the history
  • Loading branch information
sayakpaul committed Mar 4, 2024
1 parent 4a307fe commit 1cb95a1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
38 changes: 36 additions & 2 deletions .github/workflows/build_docker_images.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Build Docker images (nightly)
name: Test, build, and push Docker images

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

jobs:
build-docker-images:
test-build-docker-images:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
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

build-and-push-docker-images:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'

permissions:
contents: read
packages: write
Expand Down
3 changes: 2 additions & 1 deletion docker/diffusers-pytorch-cpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ RUN python3 -m pip install --no-cache-dir --upgrade pip uv==0.1.11 && \
numpy \
scipy \
tensorboard \
transformers
transformers \
pandas

CMD ["/bin/bash"]

0 comments on commit 1cb95a1

Please sign in to comment.