-
Notifications
You must be signed in to change notification settings - Fork 12
75 lines (69 loc) · 2.39 KB
/
Copy pathci.yml
File metadata and controls
75 lines (69 loc) · 2.39 KB
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
66
67
68
69
70
71
72
73
74
75
name: Docker Swarm Ingress CI
on:
push:
branches:
- master
tags:
- v*
paths:
- 'nginx-ingress/**'
env:
IMAGE_NAME: docker-swarm-ingress
NGINX_VERSION: 1.21.6-alpine
jobs:
build:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker-compose -f .docker-compose.yml-ci build --pull --no-cache
- name: Bringup the environment
run: docker-compose -f .docker-compose.yml-ci up -d
- name: Sleep for 30 seconds
uses: jakejarvis/wait-action@master
with:
time: '30s'
- name: List all containers
run: docker ps -a
- name: Testing connection to nginx
run: docker-compose -f .docker-compose.yml-ci exec -T nginx curl --retry 10 --retry-connrefused -I http://localhost
- uses: anchore/scan-action@v2
id: scan
with:
image: "docker-swarm-ingress:latest"
acs-report-enable: true
- name: upload Anchore scan SARIF report
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
- name: Inspect action SARIF report
run: cat ${{ steps.scan.outputs.sarif }}
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest
IMAGE_ID_TAG=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$NGINX_VERSION
echo IMAGE_ID=$IMAGE_ID
echo IMAGE_ID_TAG=$IMAGE_ID_TAG
docker tag $IMAGE_NAME:latest $IMAGE_ID
docker tag $IMAGE_NAME:latest $IMAGE_ID_TAG
docker push $IMAGE_ID
docker push $IMAGE_ID_TAG
- name: docker login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: docker push mysql-innodb-cluster image
run: |
IMAGE_ID=${{ secrets.DOCKER_USER }}/$IMAGE_NAME:latest
IMAGE_ID_TAG=${{ secrets.DOCKER_USER }}/$IMAGE_NAME:$NGINX_VERSION
echo IMAGE_ID=$IMAGE_ID
echo IMAGE_ID_TAG=$IMAGE_ID_TAG
docker tag $IMAGE_NAME:latest $IMAGE_ID
docker tag $IMAGE_NAME:latest $IMAGE_ID_TAG
docker push $IMAGE_ID
docker push $IMAGE_ID_TAG