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/.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 diff --git a/Makefile b/Makefile index 95f45f8..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) \ ) \ ) @@ -33,7 +37,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 @@ -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 diff --git a/src/Dockerfile b/src/Dockerfile index 91ff24c..f556687 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" @@ -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 \ @@ -110,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}" @@ -145,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}" @@ -230,13 +235,21 @@ ENV PATH="${PYENV_ROOT}/bin:$PATH" 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 + # # 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 diff --git a/tests/unittest.bats b/tests/unittest.bats index 0cc17f8..c66f064 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 ] } @@ -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 ]