-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.25 KB
/
build.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
name: Branch を Push したらイメージをビルドする
on:
push:
branches:
- '*' # matches every branch that doesn't contain a '/'
- '*/*' # matches every branch containing a single '/'
- '**' # matches every branch
- '!main' # excludes main
env:
IMAGE_NAME: my-ubuntu:dev
jobs:
build-test-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check Dockerfile
run: |
docker run --rm -i hadolint/hadolint < Dockerfile
- name: Build a image
id: push
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: ${{ env.IMAGE_NAME }}
labels: ${{ env.IMAGE_NAME }}
- name: Check vulnerabilities
run: |
docker images
docker run -v /var/run/docker.sock:/var/run/docker.sock --rm aquasec/trivy image --no-progress ${{ env.IMAGE_NAME }}
- name: Test a container from the image
run: |
docker images
docker run -i --name test ${{ env.IMAGE_NAME }} apt list --installed
docker ps -a