From d8644e1fa6b00c729ad1dc24db5ce497fb7bc617 Mon Sep 17 00:00:00 2001 From: Roger Sikorski Date: Sun, 12 Nov 2023 17:17:52 +0100 Subject: [PATCH 1/4] added build of ubuntu image --- .../workflows/{dev.yaml => dev_alpine.yaml} | 5 +-- .gitea/workflows/dev_ubuntu.yaml | 31 ++++++++++++++++++ .../workflows/{main.yaml => main_alpine.yaml} | 5 +-- .gitea/workflows/main_ubuntu.yaml | 32 +++++++++++++++++++ Dockerfile => dockerfile/alpine/Dockerfile | 0 dockerfile/ubuntu/Dockerfile | 9 ++++++ 6 files changed, 78 insertions(+), 4 deletions(-) rename .gitea/workflows/{dev.yaml => dev_alpine.yaml} (82%) create mode 100644 .gitea/workflows/dev_ubuntu.yaml rename .gitea/workflows/{main.yaml => main_alpine.yaml} (83%) create mode 100644 .gitea/workflows/main_ubuntu.yaml rename Dockerfile => dockerfile/alpine/Dockerfile (100%) create mode 100644 dockerfile/ubuntu/Dockerfile diff --git a/.gitea/workflows/dev.yaml b/.gitea/workflows/dev_alpine.yaml similarity index 82% rename from .gitea/workflows/dev.yaml rename to .gitea/workflows/dev_alpine.yaml index 476e6c9..268169c 100644 --- a/.gitea/workflows/dev.yaml +++ b/.gitea/workflows/dev_alpine.yaml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v3 - uses: hadolint/hadolint-action@v3.1.0 with: - dockerfile: Dockerfile + dockerfile: dockerfile/alpine/Dockerfile build: runs-on: k3s @@ -24,7 +24,8 @@ jobs: with: image: rogersik/devops-helper registry: gitea.sikorski.cloud - tag: development + tag: dev-alpine cache: true username: rogersik password: ${{ secrets.REGISTRY_PASSWORD }} + build_file: dockerfile/alpine/Dockerfile diff --git a/.gitea/workflows/dev_ubuntu.yaml b/.gitea/workflows/dev_ubuntu.yaml new file mode 100644 index 0000000..629a328 --- /dev/null +++ b/.gitea/workflows/dev_ubuntu.yaml @@ -0,0 +1,31 @@ +name: build + +on: + push: + branches-ignore: + - main + +jobs: + Dockerfile lint: + runs-on: k3s + steps: + - uses: actions/checkout@v3 + - uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: dockerfile/ubuntu/Dockerfile + + build: + runs-on: k3s + # needs: Dockerfile lint # lets process faster pull-requests + steps: + - uses: actions/checkout@v3 + - name: Kaniko build + uses: aevea/action-kaniko@master + with: + image: rogersik/devops-helper + registry: gitea.sikorski.cloud + tag: dev-ubuntu + cache: true + username: rogersik + password: ${{ secrets.REGISTRY_PASSWORD }} + build_file: dockerfile/ubuntu/Dockerfile diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main_alpine.yaml similarity index 83% rename from .gitea/workflows/main.yaml rename to .gitea/workflows/main_alpine.yaml index e8ca6f3..bbccadd 100644 --- a/.gitea/workflows/main.yaml +++ b/.gitea/workflows/main_alpine.yaml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: hadolint/hadolint-action@v3.1.0 with: - dockerfile: Dockerfile + dockerfile: Dockerfile/alpine/ build: runs-on: k3s @@ -25,7 +25,8 @@ jobs: with: image: rogersik/devops-helper registry: gitea.sikorski.cloud - tag: latest + tag: latest-alpine cache: true username: rogersik password: ${{ secrets.REGISTRY_PASSWORD }} + build_file: dockerfile/aline/Dockerfile diff --git a/.gitea/workflows/main_ubuntu.yaml b/.gitea/workflows/main_ubuntu.yaml new file mode 100644 index 0000000..12a9c72 --- /dev/null +++ b/.gitea/workflows/main_ubuntu.yaml @@ -0,0 +1,32 @@ +name: build +on: + push: + branches: + - main + schedule: + - cron: "0 6 * * SUN" + +jobs: + Dockerfile lint: + runs-on: k3s + steps: + - uses: actions/checkout@v3 + - uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: Dockerfile/ubuntu/ + + 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-ubuntu + cache: true + username: rogersik + password: ${{ secrets.REGISTRY_PASSWORD }} + build_file: dockerfile/aline/Dockerfile diff --git a/Dockerfile b/dockerfile/alpine/Dockerfile similarity index 100% rename from Dockerfile rename to dockerfile/alpine/Dockerfile diff --git a/dockerfile/ubuntu/Dockerfile b/dockerfile/ubuntu/Dockerfile new file mode 100644 index 0000000..c71fed1 --- /dev/null +++ b/dockerfile/ubuntu/Dockerfile @@ -0,0 +1,9 @@ +# https://hub.docker.com/_/alpine + +FROM ubuntu:22.04 + +RUN apt update && \ + apt install -y nano mc micro rsync ncdu git curl +COPY ./bin/ /usr/local/bin + +ENTRYPOINT ["sleep", "infinity"] -- 2.45.2 From c76d4dd11baa073ce50df571e066a08ebc1e662c Mon Sep 17 00:00:00 2001 From: Roger Sikorski Date: Sun, 12 Nov 2023 17:20:50 +0100 Subject: [PATCH 2/4] using apt-get instead apt like hadolint recommend it --- dockerfile/ubuntu/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockerfile/ubuntu/Dockerfile b/dockerfile/ubuntu/Dockerfile index c71fed1..3f8ae55 100644 --- a/dockerfile/ubuntu/Dockerfile +++ b/dockerfile/ubuntu/Dockerfile @@ -2,8 +2,8 @@ FROM ubuntu:22.04 -RUN apt update && \ - apt install -y nano mc micro rsync ncdu git curl +RUN apt-get update && \ + apt-get install -y nano mc micro rsync ncdu git curl COPY ./bin/ /usr/local/bin ENTRYPOINT ["sleep", "infinity"] -- 2.45.2 From dd0dd5243549bc86471796d3a85448bb62da876d Mon Sep 17 00:00:00 2001 From: Roger Sikorski Date: Sun, 12 Nov 2023 17:23:05 +0100 Subject: [PATCH 3/4] README.md added explanation for ubuntu image --- README.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2b0b6ad..cac8cef 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,25 @@ # admin-helper Container -[![Build Status](https://drone.sikorski.cloud/api/badges/RogerSik/docker-admin-helper/status.svg)](https://drone.sikorski.cloud/RogerSik/docker-admin-helper) -This image is builded to easier maintain unusually docker container tasks. +This image is builded to do easier maintaince tasks. Example editing config files (with some comfort). Installed tools: -* rsync -* mc -* nano +- rsync +- mc +- nano + +## Ubuntu and Alpine Images + +We are providing Ubuntu and Alpine images. Ubuntu for tasks where Alpine maybe is not good at. [Example "kubectl cp" larger files](https://github.com/kubernetes/kubernetes/issues/115573) # An example execution + ## Editing config files + ``` docker run --rm \ -v "home-assistant_config:/opt/docker-volume/" \ -it \ -w /opt/docker-volume/ \ rogersik/admin-helper -``` \ No newline at end of file +``` -- 2.45.2 From 60bd243839e9caa14e197e7fbf1c9eb2dbdbf3f1 Mon Sep 17 00:00:00 2001 From: Roger Sikorski Date: Sun, 12 Nov 2023 17:26:32 +0100 Subject: [PATCH 4/4] clean up added --- dockerfile/ubuntu/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dockerfile/ubuntu/Dockerfile b/dockerfile/ubuntu/Dockerfile index 3f8ae55..7ccc803 100644 --- a/dockerfile/ubuntu/Dockerfile +++ b/dockerfile/ubuntu/Dockerfile @@ -2,8 +2,9 @@ FROM ubuntu:22.04 -RUN apt-get update && \ - apt-get install -y nano mc micro rsync ncdu git curl +RUN apt-get update \ + && apt-get install -y nano mc micro rsync ncdu git curl \ + && rm -rf /var/lib/apt/lists/* COPY ./bin/ /usr/local/bin ENTRYPOINT ["sleep", "infinity"] -- 2.45.2