Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lholota committed Jan 21, 2020
0 parents commit 6a01bd5
Show file tree
Hide file tree
Showing 11 changed files with 213 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto
*.sh eol=lf
11 changes: 11 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
titleOnly: true
types:
- feat
- fix
- docs
- refactor
- test
- build
- ci
- chore
- revert
35 changes: 35 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# https://developer.github.com/v3/repos/#edit
repository:
name: docker-$$IMAGE_NAME$$
description: ""
homepage: https://homecentr.github.io/
private: false
has_issues: true
has_wiki: false
has_downloads: false
has_projects: false
archived: false

default_branch: master
allow_squash_merge: true
allow_merge_commit: false
allow_rebase_merge: false

# https://developer.github.com/v3/repos/branches/#update-branch-protection
branches:
- name: master
protection:
required_status_checks:
strict: true
contexts: [ ".github/workflows/ci.yml" ]
required_pull_request_reviews: null
enforce_admins: false
restrictions:

labels:
- name: bug
color: d73a4a
- name: feature
color: a2eeef
- name: question
color: d876e3
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI PR/Branch
on:
push:
branches-ignore:
- master
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: Set tag var
id: vars
run: echo ::set-output name=docker_tag::$(echo ${GITHUB_REF} | cut -d'/' -f3)-${GITHUB_SHA}

- name: Verify Dockerfile with Hadolint
uses: brpaz/hadolint-action@master

- name: Build Docker image
run: docker build .

- name: Scan with Phonito Security
uses: phonito/phonito-scanner-action@master
with:
image: ${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.docker_tag }}
phonito-token: '${{ secrets.PHONITO_TOKEN }}'
70 changes: 70 additions & 0 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI/CD on master
on:
push:
branches:
- master

env:
IMAGE_NAME: "homecentr/$$IMAGE_NAME$$"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: "Determine release version"
uses: codfish/semantic-release-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Verify Dockerfile with Hadolint
uses: brpaz/hadolint-action@master

- name: "Build Docker image"
if: env.RELEASE_VERSION != ''
run: |
docker build . -t "$IMAGE_NAME:$RELEASE_VERSION" \
--label "org.label-schema.schema-version=1.0" \
--label "org.label-schema.vcs-ref=${GITHUB_SHA}" \
--label "org.label-schema.vcs-url=https://github.com/${GITHUB_REPOSITORY}" \
--label "org.label-schema.url=https://github.com/${GITHUB_REPOSITORY}" \
--label "org.label-schema.vendor=HomeCentr" \
--label "version=$RELEASE_VERSION" \
--label "org.label-schema.build-date=$(date '+%F %T')"
- name: Scan with Phonito Security
if: env.RELEASE_VERSION != ''
uses: phonito/phonito-scanner-action@master
with:
image: ${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
phonito-token: '${{ secrets.PHONITO_TOKEN }}'

- name: "Tag image as latest"
if: env.RELEASE_VERSION != ''
run: "docker tag $IMAGE_NAME:$RELEASE_VERSION $IMAGE_NAME:latest"

- name: "Log into Docker Hub"
if: env.RELEASE_VERSION != ''
run: "echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin"

- name: "Push versioned image"
if: env.RELEASE_VERSION != ''
run: "docker push $IMAGE_NAME:$RELEASE_VERSION"

- name: "Push latest image"
if: env.RELEASE_VERSION != ''
run: "docker push $IMAGE_NAME:latest"

- name: "Update Docker Hub description"
if: env.RELEASE_VERSION != ''
uses: peter-evans/[email protected]
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKERHUB_REPOSITORY: ${{ env.IMAGE_NAME }}

- name: "Notify Microbadger to refresh metadata"
uses: wei/curl@master
with:
args: -X POST ${{ secrets.MICROBADGER_NOTIFY_URL }}
20 changes: 20 additions & 0 deletions .github/workflows/regular_scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Regular Docker image vulnerability scan
on:
schedule:
- cron: '0 6 * * *'

env:
IMAGE_NAME: "homecentr/$$IMAGE_NAME$$"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Pull Docker image
run: docker pull ${{ env.IMAGE_NAME }}:latest

- name: Scan image for vulnerabilities
uses: phonito/phonito-scanner-action@master
with:
image: ${{ env.IMAGE_NAME }}:latest
phonito-token: '${{ secrets.PHONITO_TOKEN }}'
8 changes: 8 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
branch: 'master',
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
'@semantic-release/github',
],
}
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM alpine
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 homecentr

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# HomeCentr - $$IMAGE_NAME$$
Template repository for Docker container repositories
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "homecentr-$$IMAGE_NAME$$",
"version": "1.0.0",
"description": "",
"repository": {
"type": "git",
"url": "git+https://github.com/homecentr/docker-$$IMAGE_NAME$$.git"
},
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/homecentr/docker-$$IMAGE_NAME$$/issues"
},
"homepage": "https://github.com/homecentr/docker-$$IMAGE_NAME$$#readme"
}

0 comments on commit 6a01bd5

Please sign in to comment.