-
Notifications
You must be signed in to change notification settings - Fork 112
44 lines (38 loc) · 1.12 KB
/
dockerfile_sanity.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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-22.04
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