forked from snyk-labs/java-goof
-
Notifications
You must be signed in to change notification settings - Fork 5
65 lines (54 loc) · 1.73 KB
/
todolist-goof-docker-image.yaml
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
59
60
61
62
63
64
65
name: todolist-goof Docker image build and test
on:
push:
branches:
- 'main'
paths:
- 'todolist-goof/**'
- '.github/workflows/todolist-goof-docker-image.yaml'
pull_request:
branches:
- 'main'
paths:
- 'todolist-goof/**'
- '.github/workflows/todolist-goof-docker-image.yaml'
jobs:
build-todolist-image:
runs-on: ubuntu-latest
defaults:
run:
working-directory: todolist-goof
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build
uses: docker/build-push-action@v2
with:
load: true
context: todolist-goof
push: false
tags: java-goof:latest
- name: Run container
run: docker run -d --rm --name java-goof -p 8080:8080 java-goof:latest
- name: Smoke test container
run: sleep 5 && curl -s --retry 5 --retry-delay 1 --retry-max-time 30 http://localhost:8080/todolist/
- name: Teardown container
run: docker kill java-goof
- name: Start minikube
uses: medyagh/setup-minikube@master
with:
cni: calico
- name: Deploy to minikube
run: |
sed -i 's/${DOCKER_ACCOUNT}\///' k8s/java-goof.yaml
sed -i 's/imagePullPolicy: Always/imagePullPolicy: Never/' k8s/java-goof.yaml
minikube image load java-goof:latest
kubectl apply -f k8s/java-goof.yaml
- name: Test pod came up cleanly
run: |
kubectl get all
kubectl wait --for=condition=ready pod --selector=app=goof --timeout=90s
- name: Dump pod description
if: ${{ failure() }}
run: kubectl describe pod --selector=app=goof