8000 Initial commit · homecentr/docker-cadvisor@bdb8fc8 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit bdb8fc8

Browse files
committed
Initial commit
0 parents  commit bdb8fc8

30 files changed

+701
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* text=auto
2+
*.sh eol=lf

.github/semantic.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
titleOnly: true
2+
types:
3+
- feat
4+
- fix
5+
- docs
6+
- refactor
7+
- test
8+
- build
9+
- ci
10+
- chore
11+
- revert

.github/settings.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# https://developer.github.com/v3/repos/#edit
2+
repository:
3+
name: docker-$$IMAGE_NAME$$
4+
description: ""
5+
homepage: https://homecentr.github.io/
6+
private: false
7+
has_issues: true
8+
has_wiki: false
9+
has_downloads: false
10+
has_projects: false
11+
archived: false
12+
13+
default_branch: master
14+
allow_squash_merge: true
15+
allow_merge_commit: false
16+
allow_rebase_merge: false
17+
18+
# https://developer.github.com/v3/repos/branches/#update-branch-protection
19+
branches:
20+
- name: master
21 B41A +
protection:
22+
required_status_checks:
23+
strict: true
24+
contexts: [ ".github/workflows/ci.yml" ]
25+
required_pull_request_reviews: null
26+
enforce_admins: false
27+
restrictions:
28+
29+
labels:
30+
- name: bug
31+
color: d73a4a
32+
- name: feature
33+
color: a2eeef
34+
- name: question
35+
color: d876e3

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI PR/Branch
2+
on:
3+
push:
4+
branches-ignore:
5+
- master
6+
pull_request:
7+
8+
env:
9+
IMAGE_NAME: "homecentr/$$IMAGE_NAME$$"
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@master
16+
17+
- name: Set up java for tests execution
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: 11
21+
22+
- name: Set tag var
23+
id: vars
24+
run: echo ::set-output name=docker_tag::$(echo ${GITHUB_REF} | cut -d'/' -f3)-${GITHUB_SHA}
25+
26+
- name: Verify Dockerfile with Hadolint
27+
uses: brpaz/hadolint-action@master
28+
29+
- name: Build Docker image
30+
run: docker build . -t ${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.docker_tag }}
31+
32+
- name: Test Docker image
33+
run: cd tests && gradle test --info -Dimage_tag=${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.docker_tag }}
34+
35+
- name: Scan with Phonito Security
36+
uses: phonito/phonito-scanner-action@master
37+
with:
38+
image: ${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.docker_tag }}
39+
phonito-token: '${{ secrets.PHONITO_TOKEN }}'

.github/workflows/ci_cd.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI/CD on master
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
env:
8+
IMAGE_NAME: "homecentr/$$IMAGE_NAME$$"
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@master
15+
16+
- name: Set up java for tests execution
17+
uses: actions/setup-java@v1
18+
with:
19+
java-version: 11
20+
21+
- name: "Determine release version"
22+
uses: codfish/semantic-release-action@master
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Verify Dockerfile with Hadolint
27+
uses: brpaz/hadolint-action@master
28+
29+
- name: "Build Docker image"
30+
if: env.RELEASE_VERSION != ''
31+
run: |
32+
docker build . -t "$IMAGE_NAME:$RELEASE_VERSION" \
33+
--label "org.label-schema.schema-version=1.0" \
34+
--label "org.label-schema.vcs-ref=${GITHUB_SHA}" \
35+
--label "org.label-schema.vcs-url=https://github.com/${GITHUB_REPOSITORY}" \
36+
--label "org.label-schema.url=https://github.com/${GITHUB_REPOSITORY}" \
37+
--label "org.label-schema.vendor=HomeCentr" \
38+
--label "version=$RELEASE_VERSION" \
39+
--label "org.label-schema.build-date=$(date '+%F %T')"
40+
41+
- name: Test Docker image
42+
if: env.RELEASE_VERSION != ''
43+
run: cd tests && gradle test -Dimage_tag=${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
44+
45+
- name: Scan with Phonito Security
46+
if: env.RELEASE_VERSION != ''
47+
uses: phonito/phonito-scanner-action@master
48+
with:
49+
image: ${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
50+
phonito-token: '${{ secrets.PHONITO_TOKEN }}'
51+
52+
- name: "Tag image as latest"
53+
if: env.RELEASE_VERSION != ''
54+
run: "docker tag $IMAGE_NAME:$RELEASE_VERSION $IMAGE_NAME:latest"
55+
56+
- name: "Log into Docker Hub"
57+
if: env.RELEASE_VERSION != ''
58+
run: "echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin"
59+
60+
- name: "Push versioned image"
61+
if: env.RELEASE_VERSION != ''
62+
run: "docker push $IMAGE_NAME:$RELEASE_VERSION"
63+
64+
- name: "Push latest image"
65+
if: env.RELEASE_VERSION != ''
66+
run: "docker push $IMAGE_NAME:latest"
67+
68+
- name: "Update Docker Hub description"
69+
if: env.RELEASE_VERSION != ''
70+
uses: peter-evans/dockerhub-description@v2.1.0
71+
env:
72+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
73+
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
74+
DOCKERHUB_REPOSITORY: ${{ env.IMAGE_NAME }}
75+
76+
- name: "Notify Microbadger to refresh metadata"
77+
uses: wei/curl@master
78+
with:
79+
args: -X POST ${{ secrets.MICROBADGER_NOTIFY_URL }}

.github/workflows/regular_scan.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Regular Docker image vulnerability scan
2+
on:
3+
schedule:
4+
- cron: '0 6 * * *'
5+
6+
env:
7+
IMAGE_NAME: "homecentr/$$IMAGE_NAME$$"
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Pull Docker image
14+
run: docker pull ${{ env.IMAGE_NAME }}:latest
15+
16+
- name: Scan image for vulnerabilities
17+
uses: phonito/phonito-scanner-action@master
18+
with:
19+
image: ${{ env.IMAGE_NAME }}:latest
20+
phonito-token: '${{ secrets.PHONITO_TOKEN }}'

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
*.class
2+
*.jar
3+
*.war
4+
*.ear
5+
.gradle
6+
build
7+
.gradletasknamecache
8+
9+
**/.idea/workspace.xml
10+
**/.idea/tasks.xml
11+
12+
# Ignore Gradle GUI config
13+
gradle-app.setting
14+
15+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
16+
!gradle-wrapper.jar
17+
18+
# Cache of project
19+
.gradletasknamecache

.releaserc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
branch: 'master',
3+
plugins: [
4+
'@semantic-release/commit-analyzer',
5+
'@semantic-release/release-notes-generator',
6+
'@semantic-release/github',
7+
],
8+
}

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM alpine

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 homecentr
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)
0