-
Notifications
You must be signed in to change notification settings - Fork 5
39 lines (32 loc) · 983 Bytes
/
docker-test.yml
File metadata and controls
39 lines (32 loc) · 983 Bytes
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
name: Docker Build Test
on:
pull_request:
paths:
- "**.py"
- "Dockerfile"
- "run.sh"
- "requirements.txt"
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: "Build Docker Image"
run: |
docker build -t labconnect-backend .
- name: "Run Docker Container"
run: |
docker run -d --name labconnect-backend-container labconnect-backend
sleep 60
docker logs labconnect-backend-container
docker stop labconnect-backend-container
- name: "Check for Container Exit Code"
run: |
docker inspect labconnect-backend-container --format='{{.State.ExitCode}}'
docker rm labconnect-backend-container
id: exit_code
- name: "Fail if Container Fails"
if: steps.exit_code.outputs.exit_code != '0'
run: exit 1