[Snyk] Fix for 2 vulnerabilities #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |