Skip to content

Commit

Permalink
Merge pull request #831 from rbrugaro/main
Browse files Browse the repository at this point in the history
add sanity test for docker build and run
  • Loading branch information
IlyasMoutawwakil authored Jul 29, 2024
2 parents 3ee174c + 3a55cb4 commit 7a224c2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/dockerfile_sanity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and Test Docker Image

on:
push:
branches:
- main
paths:
- 'docker/Dockerfile.intel'

pull_request:
branches:
- main
paths:
- 'docker/Dockerfile.intel'

jobs:
build_and_run:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and Run Docker Image
run: |
IMAGE_NAME="intel_image:latest"
docker build -f docker/Dockerfile.intel -t $IMAGE_NAME .
if [ $? -ne 0 ]; then
echo "Docker image build failed."
exit 1
fi
CONTAINER_ID=$(docker run -d $IMAGE_NAME tail -f /dev/null)
if docker inspect -f '{{.State.Running}}' $CONTAINER_ID 2>/dev/null | grep -q 'true'; then
echo "Container is running."
else
echo "Container failed to start."
docker logs $CONTAINER_ID 2>/dev/null || echo "No container ID found."
exit 1
fi
docker stop $CONTAINER_ID
docker rm $CONTAINER_ID
1 change: 1 addition & 0 deletions docker/Dockerfile.intel
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ARG TORCHVISION_VERSION=0.18.1+cpu
ARG TORCHAUDIO_VERSION=2.3.1+cpu

RUN python3 -m pip install --no-cache-dir \
intel-openmp \
torch==${PYTORCH_VERSION}+cpu \
torchvision==${TORCHVISION_VERSION} \
torchaudio==${TORCHAUDIO_VERSION} \
Expand Down

0 comments on commit 7a224c2

Please sign in to comment.