-
Notifications
You must be signed in to change notification settings - Fork 113
58 lines (47 loc) · 1.28 KB
/
docker.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Docker
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
TEST_TAG: rails-on-docker:test
jobs:
build-and-test-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./production.Dockerfile
push: false
load: true
tags: ${{ env.TEST_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Inspect
run: |
docker image inspect ${{ env.TEST_TAG }}
- name: Start
run: |
docker run -d --rm --name=rails-on-docker --env SECRET_KEY_BASE=dummy ${{ env.TEST_TAG }}
- name: Logs
run: |
sleep 20
docker logs rails-on-docker
- run: |
docker container ls
- name: Check Health
run: |
HEALTH_STATUS=$(docker inspect --format='{{.State.Status}}' rails-on-docker);
echo "$HEALTH_STATUS"
if [ "$HEALTH_STATUS" != "running" ]; then
exit 1
fi