From d63d1478e73065b4dcb3e221c1e6ef9b5233e244 Mon Sep 17 00:00:00 2001 From: Egon Braun Date: Fri, 14 Jun 2024 11:45:12 +0200 Subject: [PATCH 1/8] Adds bash history to git ignore --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index f7aeca7..d1f7f10 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,9 @@ Icon Network Trash Folder Temporary Items + +# +# PROJECT +# + +tmp/history/.bash_history From 491c45ca20e34068fac6d22f376c1ce709699cdf Mon Sep 17 00:00:00 2001 From: Egon Braun Date: Fri, 14 Jun 2024 11:47:40 +0200 Subject: [PATCH 2/8] Change developers group name to dev --- src/Dockerfile | 2 +- tests/unittest.bats | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Dockerfile b/src/Dockerfile index 91ff24c..105f9ab 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -26,7 +26,7 @@ ARG PROJECT_VERSION # ARG DEFAULT_LANG="C.UTF-8" -ARG DEFAULT_USER_PRIMARY_GROUP="developers" +ARG DEFAULT_USER_PRIMARY_GROUP="dev" ARG DEFAULT_USER_SECONDARY_GROUPS="sudo,docker" ARG DEFAULT_USER_SHELL="/bin/bash" ARG DEFAULT_USER="dev" diff --git a/tests/unittest.bats b/tests/unittest.bats index 0cc17f8..a994acb 100644 --- a/tests/unittest.bats +++ b/tests/unittest.bats @@ -28,8 +28,8 @@ [ "$status" -eq 0 ] } -@test "developers is the primary group of dev user" { - run bash -c "id dev | grep -E 'gid=[0-9]+\(developers\)'" +@test "dev is the primary group of dev user" { + run bash -c "id dev | grep -E 'gid=[0-9]+\(dev\)'" [ "$status" -eq 0 ] } @@ -48,7 +48,7 @@ # @test "sudo is configured" { - run ls /etc/sudoers.d/developers + run ls /etc/sudoers.d/dev [ "$status" -eq 0 ] } From 1e498533df2ef3ddefc4989670c2f45e576432a0 Mon Sep 17 00:00:00 2001 From: Egon Braun Date: Fri, 14 Jun 2024 10:47:08 +0000 Subject: [PATCH 3/8] Adds PyCharm system dependencies --- src/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Dockerfile b/src/Dockerfile index 105f9ab..cff3db7 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -78,11 +78,16 @@ RUN export DEBIAN_FRONTEND="noninteractive" \ libffi-dev \ liblzma-dev \ libncursesw5-dev \ + libprocps-dev \ libreadline-dev \ libsqlite3-dev \ libssl-dev \ + libxi-dev \ + libxi6 \ libxml2-dev \ libxmlsec1-dev \ + libxtst-dev \ + libxtst6 \ locales \ lsb-release \ make \ From 04ab4b7ece807e1bae8aabd1aa79c28cb6a4f0bb Mon Sep 17 00:00:00 2001 From: Egon Braun Date: Fri, 14 Jun 2024 11:13:14 +0000 Subject: [PATCH 4/8] Update software versions --- src/Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Dockerfile b/src/Dockerfile index cff3db7..256dfe3 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -115,9 +115,9 @@ RUN locale-gen "${DEFAULT_LANG}" \ # INSTALL DOCKER # -ENV VERSION_DOCKER_CLI="25.0.0-1" -ENV VERSION_DOCKER_BUILDX_PLUGIN="0.12.1-1" -ENV VERSION_DOCKER_COMPOSE_PLUGIN="2.24.1-1" +ENV VERSION_DOCKER_CLI="26.1.4-1" +ENV VERSION_DOCKER_BUILDX_PLUGIN="0.14.1-1" +ENV VERSION_DOCKER_COMPOSE_PLUGIN="2.27.1-1" ENV FILENAME_DOCKER_SUFFIX="ubuntu.${VERSION_UBUNTU}~${VERSION_UBUNTU_NAME}_${TARGETARCH}.deb" ENV FILENAME_DOCKER_CLI="docker-ce-cli_${VERSION_DOCKER_CLI}~${FILENAME_DOCKER_SUFFIX}" ENV FILENAME_DOCKER_BUILDX_PLUGIN="docker-buildx-plugin_${VERSION_DOCKER_BUILDX_PLUGIN}~${FILENAME_DOCKER_SUFFIX}" @@ -150,7 +150,7 @@ RUN curl -sSL -o /usr/local/bin/hadolint "${URL_HADOLINT}" \ # INSTALL GIT DELTA # -ENV VERSION_GIT_DELTA="0.16.5" +ENV VERSION_GIT_DELTA="0.17.0" ENV FILENAME_GIT_DELTA="git-delta_${VERSION_GIT_DELTA}_${TARGETARCH}.deb" ENV URL_GIT_DELTA_BASE="https://github.com/dandavison/delta/releases/download/${VERSION_GIT_DELTA}" ENV URL_GIT_DELTA="${URL_GIT_DELTA_BASE}/${FILENAME_GIT_DELTA}" @@ -239,9 +239,9 @@ RUN curl -fsSL https://pyenv.run | bash # OTHER TOOLS # -ENV VERSION_CHECKOV="3.2.16" -ENV VERSION_POETRY="1.7.1" -ENV VERSION_PRECOMMIT="3.6.0" +ENV VERSION_CHECKOV="3.2.136" +ENV VERSION_POETRY="1.8.3" +ENV VERSION_PRECOMMIT="3.7.1" # # PYTHON From 090ee1ba8bab19b7d77886def1c61622a1e791b7 Mon Sep 17 00:00:00 2001 From: Egon Braun Date: Fri, 14 Jun 2024 11:13:38 +0000 Subject: [PATCH 5/8] Adds rbenv --- src/Dockerfile | 6 ++++++ tests/unittest.bats | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/Dockerfile b/src/Dockerfile index 256dfe3..349b19f 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -235,6 +235,12 @@ ENV PATH="${PYENV_ROOT}/bin:$PATH" RUN curl -fsSL https://pyenv.run | bash +# +# INSTALL RBENV +# + +RUN curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash + # # OTHER TOOLS # diff --git a/tests/unittest.bats b/tests/unittest.bats index a994acb..c66f064 100644 --- a/tests/unittest.bats +++ b/tests/unittest.bats @@ -116,6 +116,11 @@ [ "$status" -eq 0 ] } +@test "rbenv is installed" { + run which rbenv + [ "$status" -eq 0 ] +} + @test "starship is installed" { run which starship [ "$status" -eq 0 ] From 119a1d0ab93800e0c26fc7bbf7ee0ba8b3568faa Mon Sep 17 00:00:00 2001 From: Egon Braun Date: Fri, 14 Jun 2024 11:21:52 +0000 Subject: [PATCH 6/8] Change cache type to inline as default --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 95f45f8..71f7696 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ PROJECT_VERSION ?= $(strip \ # PROJECT_DOCKER_BUILDER := builder-$(PROJECT_NAME) -PROJECT_DOCKER_CACHE_BACKEND ?= local +PROJECT_DOCKER_CACHE_BACKEND ?= inline PROJECT_DOCKER_HOST ?= index.docker.io PROJECT_DOCKER_ORG ?= $(error PROJECT_DOCKER_ORG is not set) PROJECT_DOCKER_PLATFORMS ?= linux/arm64,linux/amd64 From c37b417917662ee0a952d04245b990066867bb3e Mon Sep 17 00:00:00 2001 From: Egon Braun Date: Fri, 14 Jun 2024 13:31:18 +0000 Subject: [PATCH 7/8] Adds rbenv to PATH --- src/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Dockerfile b/src/Dockerfile index 349b19f..f556687 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -239,6 +239,8 @@ RUN curl -fsSL https://pyenv.run | bash # INSTALL RBENV # +ENV PATH="${HOME}/.rbenv/bin:${PATH}" + RUN curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash # From d30cbd43c89e1421aee2b3ba2224a8a5a0c16dff Mon Sep 17 00:00:00 2001 From: Egon Braun Date: Fri, 14 Jun 2024 13:31:56 +0000 Subject: [PATCH 8/8] Improve build and test processes --- .github/workflows/pipeline.yml | 6 ------ Makefile | 22 +++++++++++++--------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index bec3d78..b655584 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -92,12 +92,6 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build - env: - PROJECT_DOCKER_PLATFORMS: ${{ matrix.platforms }} - run: | - make build - - name: Test env: PROJECT_DOCKER_PLATFORMS: ${{ matrix.platforms }} diff --git a/Makefile b/Makefile index 71f7696..3330092 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,12 @@ PROJECT_COMMIT ?= $(shell git rev-parse HEAD) PROJECT_NAME ?= $(error PROJECT_NAME is not set) PROJECT_VERSION ?= $(strip \ $(if \ - $(shell git rev-list --tags --max-count=1), \ - $(shell git describe --tags `git rev-list --tags --max-count=1`), \ + $(value $CI), \ + $(if \ + $(shell git rev-list --tags --max-count=1), \ + $(shell git describe --tags `git rev-list --tags --max-count=1`), \ + $(shell git rev-parse --short HEAD) \ + ), \ $(shell git rev-parse --short HEAD) \ ) \ ) @@ -44,7 +48,7 @@ PROJECT_DOCKER_REPOSITORY ?= $(PROJECT_NAME) # DEFAULT_LANG ?= C.UTF-8 -DEFAULT_USER_PRIMARY_GROUP ?= developers +DEFAULT_USER_PRIMARY_GROUP ?= dev DEFAULT_USER_SECONDARY_GROUPS ?= sudo,docker DEFAULT_USER_SHELL ?= /bin/bash DEFAULT_USER ?= dev @@ -156,21 +160,21 @@ reset: clean || echo -n "" .PHONY: test -test: +test: build @for platform in `echo ${PROJECT_DOCKER_PLATFORMS} | tr ',' ' '`; do \ arch="$$(echo $$platform | cut -d/ -f2)"; \ - echo "Testing $(PROJECT_NAME)-test:$$arch"; \ + echo "Testing $(PROJECT_NAME)-$(PROJECT_VERSION)-test:$$arch"; \ docker build \ --build-arg PROJECT_NAME="$(PROJECT_NAME)" \ --build-arg PROJECT_VERSION="$(PROJECT_VERSION)-$$arch" \ - --cache-from type=gha \ - --cache-to type=gha,mode=max \ + --cache-from "type=$(PROJECT_DOCKER_CACHE_BACKEND)" \ + --cache-to "type=$(PROJECT_DOCKER_CACHE_BACKEND),mode=max" \ --file "$(SOURCE_DIR)/Dockerfile.test" \ --platform "$$platform" \ - --tag "$(PROJECT_NAME)-test:$$arch" \ + --tag "$(PROJECT_NAME)-test:$(PROJECT_VERSION)-$$arch" \ . \ && docker run \ --platform "$$platform" \ --rm \ - "$(PROJECT_NAME)-test:$$arch"; \ + "$(PROJECT_NAME)-test:$(PROJECT_VERSION)-$$arch"; \ done