From 41fd71d8265d58a53df722b7f37bdd0d9518270c Mon Sep 17 00:00:00 2001 From: Roger Sikorski Date: Tue, 22 Aug 2023 17:37:35 +0200 Subject: [PATCH] hadolint, k3s and kaniko build added (#5) Reviewed-on: https://gitea.sikorski.cloud/RogerSik/docker-devops-helper/pulls/5 --- .gitea/workflows/dev.yaml | 37 ++++++++++++++++++++----------------- .gitea/workflows/main.yaml | 37 ++++++++++++++++++++----------------- .hadolint.yaml | 3 +++ Dockerfile | 4 ++-- 4 files changed, 45 insertions(+), 36 deletions(-) create mode 100644 .hadolint.yaml diff --git a/.gitea/workflows/dev.yaml b/.gitea/workflows/dev.yaml index 0f15f72..8136603 100644 --- a/.gitea/workflows/dev.yaml +++ b/.gitea/workflows/dev.yaml @@ -6,22 +6,25 @@ on: - main jobs: - build: - runs-on: docker + Dockerfile lint: + runs-on: k3s steps: - uses: actions/checkout@v3 - - name: docker login - run: docker login -u $REGISTRY_USER -p $REGISTRY_PASSWORD gitea.sikorski.cloud - env: - REGISTRY_USER: ${{ secrets.REGISTRY_USER }} - REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} - - name: Pull Docker Image for caching - run: docker pull gitea.sikorski.cloud/rogersik/devops-helper:development || exit 0 - - name: Build docker image - run: | - docker build . \ - --cache-from gitea.sikorski.cloud/rogersik/devops-helper:development \ - --file Dockerfile \ - --tag gitea.sikorski.cloud/rogersik/devops-helper:development - - name: Push docker image - run: docker push gitea.sikorski.cloud/rogersik/devops-helper --all-tags + - uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: Dockerfile + + build: + runs-on: k3s + needs: Dockerfile lint + steps: + - uses: actions/checkout@v3 + - name: Kaniko build + uses: aevea/action-kaniko@master + with: + image: rogersik/devops-helper + registry: gitea.sikorski.cloud + tag: development + cache: true + username: rogersik + password: ${{ secrets.REGISTRY_PASSWORD }} diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml index 3d388c1..e8ca6f3 100644 --- a/.gitea/workflows/main.yaml +++ b/.gitea/workflows/main.yaml @@ -7,22 +7,25 @@ on: - cron: "0 6 * * SUN" jobs: - build: - runs-on: docker + Dockerfile lint: + runs-on: k3s steps: - uses: actions/checkout@v3 - - name: docker login - run: docker login -u $REGISTRY_USER -p $REGISTRY_PASSWORD gitea.sikorski.cloud - env: - REGISTRY_USER: ${{ secrets.REGISTRY_USER }} - REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} - - name: Pull Docker Image for caching - run: docker pull gitea.sikorski.cloud/rogersik/devops-helper:development || exit 0 - - name: Build docker image - run: | - docker build . \ - --cache-from gitea.sikorski.cloud/rogersik/devops-helper:development \ - --file Dockerfile \ - --tag gitea.sikorski.cloud/rogersik/devops-helper:latest - - name: Push docker image - run: docker push gitea.sikorski.cloud/rogersik/devops-helper --all-tags + - uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: Dockerfile + + build: + runs-on: k3s + needs: Dockerfile lint + steps: + - uses: actions/checkout@v3 + - name: Kaniko build + uses: aevea/action-kaniko@master + with: + image: rogersik/devops-helper + registry: gitea.sikorski.cloud + tag: latest + cache: true + username: rogersik + password: ${{ secrets.REGISTRY_PASSWORD }} diff --git a/.hadolint.yaml b/.hadolint.yaml new file mode 100644 index 0000000..2cecf68 --- /dev/null +++ b/.hadolint.yaml @@ -0,0 +1,3 @@ +ignored: + - DL3013 # https://github.com/hadolint/hadolint/wiki/DL3013 allow install latest package + - DL3018 # https://github.com/hadolint/hadolint/wiki/DL3018 no need to pin specific version diff --git a/Dockerfile b/Dockerfile index c26cac5..7d31d4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # https://hub.docker.com/_/alpine -FROM alpine:latest +FROM alpine:3.18 RUN apk update && \ apk add --no-cache nano mc micro rsync ncdu git curl -ADD ./bin/ /usr/local/bin +COPY ./bin/ /usr/local/bin