Skip to content

Commit 7a224c2

Browse files
Merge pull request #831 from rbrugaro/main
add sanity test for docker build and run
2 parents 3ee174c + 3a55cb4 commit 7a224c2

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build and Test Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docker/Dockerfile.intel'
9+
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- 'docker/Dockerfile.intel'
15+
16+
jobs:
17+
build_and_run:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Build and Run Docker Image
28+
run: |
29+
IMAGE_NAME="intel_image:latest"
30+
docker build -f docker/Dockerfile.intel -t $IMAGE_NAME .
31+
if [ $? -ne 0 ]; then
32+
echo "Docker image build failed."
33+
exit 1
34+
fi
35+
CONTAINER_ID=$(docker run -d $IMAGE_NAME tail -f /dev/null)
36+
if docker inspect -f '{{.State.Running}}' $CONTAINER_ID 2>/dev/null | grep -q 'true'; then
37+
echo "Container is running."
38+
else
39+
echo "Container failed to start."
40+
docker logs $CONTAINER_ID 2>/dev/null || echo "No container ID found."
41+
exit 1
42+
fi
43+
docker stop $CONTAINER_ID
44+
docker rm $CONTAINER_ID

docker/Dockerfile.intel

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ ARG TORCHVISION_VERSION=0.18.1+cpu
3737
ARG TORCHAUDIO_VERSION=2.3.1+cpu
3838

3939
RUN python3 -m pip install --no-cache-dir \
40+
intel-openmp \
4041
torch==${PYTORCH_VERSION}+cpu \
4142
torchvision==${TORCHVISION_VERSION} \
4243
torchaudio==${TORCHAUDIO_VERSION} \

0 commit comments

Comments
 (0)