diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2c7d170..8e85703 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,3 +1,4 @@ +--- version: 2 updates: # Maintain dependencies for GitHub Actions diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 0000000..9a507e8 --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,12 @@ +# The labels in this file are automatically synced with the repository +# using the micnncim/action-label-syncer action. +--- +- name: C-dependency + color: 1abc9c + description: "Category: Dependency" +- name: PR-block + color: 3498db + description: "Pull Request: Do not merge" +- name: PR-merge + color: 3498db + description: "Pull Request: Merge when ready" diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..03439b4 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,33 @@ +--- +name-template: '$RESOLVED_VERSION 🌈' +tag-template: '$RESOLVED_VERSION' +version-template: '$MAJOR.$MINOR' +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '🧰 Maintenance' + label: 'chore' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: minor +template: | + ## Changes + + $CHANGES diff --git a/.github/workflows/action_branch.yml b/.github/workflows/action_branch.yml new file mode 100644 index 0000000..b102724 --- /dev/null +++ b/.github/workflows/action_branch.yml @@ -0,0 +1,34 @@ +--- + +# ------------------------------------------------------------------------------------------------- +# Job Name +# ------------------------------------------------------------------------------------------------- +name: build + + +# ------------------------------------------------------------------------------------------------- +# When to run +# ------------------------------------------------------------------------------------------------- +on: + push: + + +jobs: + + # (1/2) Determine repository params + params: + uses: ./.github/workflows/params.yml + + # (2/2) Build + docker: + needs: [params] + uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master + with: + enabled: true + can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }} + name: ${{ needs.params.outputs.name }} + matrix: ${{ needs.params.outputs.matrix }} + refs: ${{ needs.params.outputs.refs }} + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} diff --git a/.github/workflows/action_pull_request.yml b/.github/workflows/action_pull_request.yml new file mode 100644 index 0000000..a4e3e96 --- /dev/null +++ b/.github/workflows/action_pull_request.yml @@ -0,0 +1,36 @@ +--- + +# ------------------------------------------------------------------------------------------------- +# Job Name +# ------------------------------------------------------------------------------------------------- +name: build + + +# ------------------------------------------------------------------------------------------------- +# When to run +# ------------------------------------------------------------------------------------------------- +on: + pull_request: + + +jobs: + + # (1/2) Determine repository params + params: + uses: ./.github/workflows/params.yml + # Only run for forks (contributor) + if: github.event.pull_request.head.repo.fork + + # (2/2) Build + docker: + needs: [params] + uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master + with: + enabled: true + can_deploy: false + name: ${{ needs.params.outputs.name }} + matrix: ${{ needs.params.outputs.matrix }} + refs: ${{ needs.params.outputs.refs }} + secrets: + dockerhub_username: "" + dockerhub_password: "" diff --git a/.github/workflows/action_schedule.yml b/.github/workflows/action_schedule.yml new file mode 100644 index 0000000..80d3d38 --- /dev/null +++ b/.github/workflows/action_schedule.yml @@ -0,0 +1,36 @@ +--- + +# ------------------------------------------------------------------------------------------------- +# Job Name +# ------------------------------------------------------------------------------------------------- +name: nightly + + +# ------------------------------------------------------------------------------------------------- +# When to run +# ------------------------------------------------------------------------------------------------- +on: + # Runs daily + schedule: + - cron: '0 0 * * *' + + +jobs: + + # (1/2) Determine repository params + params: + uses: ./.github/workflows/params.yml + + # (2/2) Build + docker: + needs: [params] + uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master + with: + enabled: true + can_deploy: true + name: ${{ needs.params.outputs.name }} + matrix: ${{ needs.params.outputs.matrix }} + refs: ${{ needs.params.outputs.refs }} + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 7a6341b..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,166 +0,0 @@ ---- - -# ------------------------------------------------------------------------------------------------- -# Job Name -# ------------------------------------------------------------------------------------------------- -name: build - - -# ------------------------------------------------------------------------------------------------- -# When to run -# ------------------------------------------------------------------------------------------------- -on: - # Runs on Push - push: - - -jobs: - - # ----------------------------------------------------------------------------------------------- - # Job (1/2): BUILD - # ----------------------------------------------------------------------------------------------- - build: - name: "[ ${{ matrix.version }} (${{ matrix.arch }}) ]" - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: - - 'Apache 2.4' - arch: - - 'linux/amd64' - - 'linux/arm64' - - 'linux/386' - - 'linux/arm/v7' - - 'linux/arm/v6' - steps: - - # ------------------------------------------------------------ - # Setup repository - # ------------------------------------------------------------ - - name: "[SETUP] Checkout repository" - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: "[SETUP] Setup QEMU environment" - uses: docker/setup-qemu-action@v1 - with: - image: tonistiigi/binfmt:latest - platforms: all - - - name: "[SETUP] Determine Docker tag" - id: tag - uses: cytopia/docker-tag@v0.3 - - # ------------------------------------------------------------ - # Build - # ------------------------------------------------------------ - - name: Build - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make build ARCH=${ARCH} - env: - ARCH: ${{ matrix.arch }} - - # ------------------------------------------------------------ - # Test - # ------------------------------------------------------------ - - name: "[TEST] Docker Image" - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make test ARCH=${ARCH} - env: - ARCH: ${{ matrix.arch }} - - - name: "[TEST] Update README" - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make update-readme ARCH=${ARCH} - env: - ARCH: ${{ matrix.arch }} - - # ------------------------------------------------------------ - # Deploy - # ------------------------------------------------------------ - - name: "[DEPLOY] Login" - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: "[DEPLOY] Publish architecture image (only repo owner)" - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make push-arch TAG=${{ steps.tag.outputs.docker-tag }} ARCH=${ARCH} - env: - ARCH: ${{ matrix.arch }} - # https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions - if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id - && ( - (github.event_name == 'schedule' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))) - || - (github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))) - || - (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-')) - ) - - # ----------------------------------------------------------------------------------------------- - # Job (2/2): DEPLOY - # ----------------------------------------------------------------------------------------------- - deploy: - needs: [build] - name: Deploy - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: - - 'Apache 2.4' - steps: - - # ------------------------------------------------------------ - # Setup repository - # ------------------------------------------------------------ - - name: "[SETUP] Checkout repository" - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: "[SETUP] Determine Docker tag" - id: tag - uses: cytopia/docker-tag@v0.3 - - # ------------------------------------------------------------ - # Deploy - # ------------------------------------------------------------ - - name: "[DEPLOY] Login" - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: "[DEPLOY] Create Docker manifest" - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make manifest-create TAG=${{ steps.tag.outputs.docker-tag }} ARCH="linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6" - - - name: "[DEPLOY] Publish Docker manifest (only repo owner)" - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make manifest-push TAG=${{ steps.tag.outputs.docker-tag }} - # https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions - if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id - && ( - (github.event_name == 'schedule' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))) - || - (github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))) - || - (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-')) - ) diff --git a/.github/workflows/contributor.yml b/.github/workflows/contributor.yml deleted file mode 100644 index cd568c4..0000000 --- a/.github/workflows/contributor.yml +++ /dev/null @@ -1,86 +0,0 @@ ---- - -# ------------------------------------------------------------------------------------------------- -# Job Name -# ------------------------------------------------------------------------------------------------- -name: build - - -# ------------------------------------------------------------------------------------------------- -# When to run -# ------------------------------------------------------------------------------------------------- -on: - # Runs on Pull Requests - pull_request: - - -jobs: - - # ----------------------------------------------------------------------------------------------- - # Job (1/2): BUILD - # ----------------------------------------------------------------------------------------------- - build: - name: "[ ${{ matrix.version }} (${{ matrix.arch }}) ]" - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: - - 'Apache 2.4' - arch: - - 'linux/amd64' - - 'linux/arm64' - - 'linux/386' - - 'linux/arm/v7' - - 'linux/arm/v6' - # Only run for forks (contributor) - if: ${{ github.event.pull_request.head.repo.fork }} - steps: - - # ------------------------------------------------------------ - # Setup repository - # ------------------------------------------------------------ - - name: "[SETUP] Checkout repository" - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: "[SETUP] Setup QEMU environment" - uses: docker/setup-qemu-action@v1 - with: - image: tonistiigi/binfmt:latest - platforms: all - - - name: "[SETUP] Determine Docker tag" - id: tag - uses: cytopia/docker-tag@v0.3 - - # ------------------------------------------------------------ - # Build - # ------------------------------------------------------------ - - name: Build - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make build ARCH=${ARCH} - env: - ARCH: ${{ matrix.arch }} - - # ------------------------------------------------------------ - # Test - # ------------------------------------------------------------ - - name: "[TEST] Docker Image" - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make test ARCH=${ARCH} - env: - ARCH: ${{ matrix.arch }} - - - name: "[TEST] Update README" - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make update-readme ARCH=${ARCH} - env: - ARCH: ${{ matrix.arch }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 57a401b..f83d099 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,21 +19,4 @@ on: # ------------------------------------------------------------------------------------------------- jobs: lint: - name: "Lint" - runs-on: ubuntu-latest - steps: - # ------------------------------------------------------------ - # Setup repository - # ------------------------------------------------------------ - - name: Checkout repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - # ------------------------------------------------------------ - # Lint repository - # ------------------------------------------------------------ - - name: Lint workflow - id: vars - run: | - make lint-workflow + uses: devilbox/github-actions/.github/workflows/lint-generic.yml@master diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index 8690e45..0000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,175 +0,0 @@ ---- - -# ------------------------------------------------------------------------------------------------- -# Job Name -# ------------------------------------------------------------------------------------------------- -name: nightly - - -# ------------------------------------------------------------------------------------------------- -# When to run -# ------------------------------------------------------------------------------------------------- -on: - # Runs daily - schedule: - - cron: '0 0 * * *' - - -jobs: - - # ----------------------------------------------------------------------------------------------- - # Job: BUILD - # ----------------------------------------------------------------------------------------------- - build: - name: "[ ${{ matrix.version }} (${{ matrix.arch }}) ] (ref: ${{ matrix.refs }})" - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: - - 'Apache 2.4' - arch: - - 'linux/amd64' - - 'linux/arm64' - - 'linux/386' - - 'linux/arm/v7' - - 'linux/arm/v6' - refs: - - 'master' - - '0.41' - steps: - - # ------------------------------------------------------------ - # Setup repository - # ------------------------------------------------------------ - - name: "[SETUP] Checkout repository" - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ matrix.refs }} - - - name: "[SETUP] Setup QEMU environment" - uses: docker/setup-qemu-action@v1 - with: - image: tonistiigi/binfmt:latest - platforms: all - - - name: "[SETUP] Determine Docker tag" - id: tag - uses: cytopia/docker-tag@v0.3 - - # ------------------------------------------------------------ - # Build - # ------------------------------------------------------------ - - name: Build - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make build ARCH=${ARCH} - env: - ARCH: ${{ matrix.arch }} - - # ------------------------------------------------------------ - # Test - # ------------------------------------------------------------ - - name: "[TEST] Docker Image" - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make test ARCH=${ARCH} - env: - ARCH: ${{ matrix.arch }} - - - name: "[TEST] Update README" - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make update-readme ARCH=${ARCH} - env: - ARCH: ${{ matrix.arch }} - - # ------------------------------------------------------------ - # Deploy - # ------------------------------------------------------------ - - name: "[DEPLOY] Login" - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: "[DEPLOY] Publish architecture image (only repo owner)" - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make push-arch TAG=${{ steps.tag.outputs.docker-tag }} ARCH=${ARCH} - env: - ARCH: ${{ matrix.arch }} - # https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions - if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id - && ( - (github.event_name == 'schedule' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))) - || - (github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))) - || - (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-')) - ) - - # ----------------------------------------------------------------------------------------------- - # Job (2/2): DEPLOY - # ----------------------------------------------------------------------------------------------- - deploy: - needs: [build] - name: "[ Deploy (ref: ${{ matrix.refs }})" - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: - - 'Apache 2.4' - refs: - - 'master' - - '0.41' - steps: - - # ------------------------------------------------------------ - # Setup repository - # ------------------------------------------------------------ - - name: "[SETUP] Checkout repository" - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ matrix.refs }} - - - name: "[SETUP] Determine Docker tag" - id: tag - uses: cytopia/docker-tag@v0.3 - - # ------------------------------------------------------------ - # Deploy - # ------------------------------------------------------------ - - name: "[DEPLOY] Login" - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: "[DEPLOY] Create Docker manifest" - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make manifest-create TAG=${{ steps.tag.outputs.docker-tag }} ARCH="linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6" - - - name: "[DEPLOY] Publish Docker manifest (only repo owner)" - uses: cytopia/shell-command-retry-action@v0.1 - with: - command: | - make manifest-push TAG=${{ steps.tag.outputs.docker-tag }} - # https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions - if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id - && ( - (github.event_name == 'schedule' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))) - || - (github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))) - || - (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-')) - ) diff --git a/.github/workflows/params.yml b/.github/workflows/params.yml new file mode 100644 index 0000000..bf6edfa --- /dev/null +++ b/.github/workflows/params.yml @@ -0,0 +1,85 @@ +--- + +# ------------------------------------------------------------------------------------------------- +# Job Name +# ------------------------------------------------------------------------------------------------- +name: params + + +# ------------------------------------------------------------------------------------------------- +# Custom Variables +# ------------------------------------------------------------------------------------------------- +env: + NAME: Apache + MATRIX: >- + [ + { + "NAME": "Apache", + "VERSION": ["2.4"], + "ARCH": ["linux/amd64", "linux/386", "linux/arm64", "linux/arm/v7", "linux/arm/v6"] + + } + ] + + +# ------------------------------------------------------------------------------------------------- +# When to run +# ------------------------------------------------------------------------------------------------- +on: + workflow_call: + outputs: + name: + description: "The project name" + value: ${{ jobs.params.outputs.name }} + matrix: + description: "The determined version matrix" + value: ${{ jobs.params.outputs.matrix }} + refs: + description: "The determined git ref matrix (only during scheduled run)" + value: ${{ jobs.params.outputs.refs }} + +jobs: + params: + runs-on: ubuntu-latest + + outputs: + name: ${{ steps.set-name.outputs.name }} + matrix: ${{ steps.set-matrix.outputs.matrix }} + refs: ${{ steps.set-refs.outputs.matrix }} + + steps: + - name: "Set Name" + id: set-name + run: | + echo '::set-output name=name::${{ env.NAME }}' + + - name: "[Set-Output] Matrix" + id: set-matrix + run: | + echo "::set-output name=matrix::$( echo '${{ env.MATRIX }}' | jq -M -c )" + + - name: "[Set-Output] Matrix 'Refs' (master branch and latest tag)" + id: set-refs + uses: cytopia/git-ref-matrix-action@v0.1.2 + with: + repository_default_branch: master + branches: master + num_latest_tags: 1 + if: github.event_name == 'schedule' + + - name: "[DEBUG] Show settings'" + run: | + echo 'Name' + echo '--------------------' + echo '${{ steps.set-name.outputs.name }}' + echo + + echo 'Matrix' + echo '--------------------' + echo '${{ steps.set-matrix.outputs.matrix }}' + echo + + echo 'Matrix: Refs' + echo '--------------------' + echo '${{ steps.set-matrix-refs.outputs.matrix }}' + echo diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..1a63d7e --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,19 @@ +--- +name: Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - master + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + with: + publish: true + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_DRAFTER_TOKEN }} diff --git a/.github/workflows/repository.yml b/.github/workflows/repository.yml new file mode 100644 index 0000000..ca21e7d --- /dev/null +++ b/.github/workflows/repository.yml @@ -0,0 +1,25 @@ +--- +name: Repository + +on: + push: + branches: + - master + paths: + - .github/labels.yml + +jobs: + labels: + name: Labels + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Sync labels + uses: micnncim/action-label-syncer@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + manifest: .github/labels.yml diff --git a/.gitignore b/.gitignore index cc3a8c2..7457dff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,86 +1,2 @@ -# Note: -# To effectively apply the changes you will have -# to re-index the git index (if there are already -# commited files) -# -# $ git rm -r --cached . -# $ git add . -# $ git commit -m ".gitignore index rebuild" -# - - -###################################### -# CUSTOM -###################################### - - -###################################### -# GENERIC -###################################### - -###### std ###### -.lock -*.log - -###### patches/diffs ###### -*.patch -*.diff -*.orig -*.rej - - -###################################### -# Operating Systems -###################################### - -###### OSX ###### -._* -.DS* -.Spotlight-V100 -.Trashes - -###### Windows ###### -Thumbs.db -ehthumbs.db -Desktop.ini -$RECYCLE.BIN/ -*.lnk -*.shortcut - -###################################### -# Editors -###################################### - -###### Sublime ###### -*.sublime-workspace -*.sublime-project - -###### Eclipse ###### -.classpath -.buildpath -.project -.settings/ - -###### Netbeans ###### -/nbproject/ - -###### Intellij IDE ###### -.idea/ -.idea_modules/ - -###### vim ###### -*.swp -*.swo -*.swn -*.swm -*~ - -###### TextMate ###### -.tm_properties -*.tmproj - -###### BBEdit ###### -*.bbprojectd -*.bbproject - -.vagrant +Makefile.docker +Makefile.lint diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..07e4861 --- /dev/null +++ b/.yamllint @@ -0,0 +1,13 @@ +--- +extends: default + +ignore: | + .yamllint + + +rules: + truthy: + allowed-values: ['true', 'false', 'yes', 'no'] + check-keys: False + level: error + line-length: disable diff --git a/Makefile b/Makefile index 6b17ef4..6d24b8b 100644 --- a/Makefile +++ b/Makefile @@ -2,17 +2,35 @@ ifneq (,) .error This Makefile requires GNU Make. endif +# Ensure additional Makefiles are present +MAKEFILES = Makefile.docker Makefile.lint +$(MAKEFILES): URL=https://raw.githubusercontent.com/devilbox/makefiles/master/$(@) +$(MAKEFILES): + @if ! (curl --fail -sS -o $(@) $(URL) || wget -O $(@) $(URL)); then \ + echo "Error, curl or wget required."; \ + echo "Exiting."; \ + false; \ + fi +include $(MAKEFILES) + +# Set default Target +.DEFAULT_GOAL := help + # ------------------------------------------------------------------------------------------------- -# Docker configuration +# Default configuration # ------------------------------------------------------------------------------------------------- +# Own vars +TAG = latest -DIR = . -FILE = Dockerfile -IMAGE = devilbox/apache-2.4 -TAG = latest -ARCH = linux/amd64 -NO_CACHE = +# Makefile.docker overwrites +NAME = Apache +VERSION = 2.4 +IMAGE = devilbox/apache-2.4 +DIR = . +FILE = Dockerfile +DOCKER_TAG = $(TAG) +ARCH = linux/amd64 # ------------------------------------------------------------------------------------------------- @@ -20,79 +38,42 @@ NO_CACHE = # ------------------------------------------------------------------------------------------------- .PHONY: help help: - @echo "lint Lint project files and repository" + @echo "lint Lint project files and repository" @echo - @echo "build Build Docker image" - @echo "rebuild Build Docker image without cache" + @echo "build [ARCH=...] [TAG=...] Build Docker image" + @echo "rebuild [ARCH=...] [TAG=...] Build Docker image without cache" + @echo "push [ARCH=...] [TAG=...] Push Docker image to Docker hub" @echo - @echo "manifest-create Create multi-arch manifest" - @echo "manifest-push Push multi-arch manifest" + @echo "manifest-create [ARCHES=...] [TAG=...] Create multi-arch manifest" + @echo "manifest-push [TAG=...] Push multi-arch manifest" @echo - @echo "test Test built Docker image" - @echo "update-readme Update README.md with PHP modules" + @echo "test [ARCH=...] Test built Docker image" @echo - @echo "tag [TAG=...] Retag Docker image" - @echo "login USER=... PASS=... Login to Docker hub" - @echo "push [TAG=...] Push Docker image to Docker hub" - - -# ------------------------------------------------------------------------------------------------- -# Lint Targets -# ------------------------------------------------------------------------------------------------- -.PHONY: lint -lint: lint-workflow - -.PHONY: lint-workflow -lint-workflow: - @\ - GIT_CURR_MAJOR="$$( git tag | sort -V | tail -1 | sed 's|\.[0-9]*$$||g' )"; \ - GIT_CURR_MINOR="$$( git tag | sort -V | tail -1 | sed 's|^[0-9]*\.||g' )"; \ - GIT_NEXT_TAG="$${GIT_CURR_MAJOR}.$$(( GIT_CURR_MINOR + 1 ))"; \ - grep 'refs:' -A 20 .github/workflows/nightly.yml \ - | grep '^ -' \ - | grep -v master \ - | while read -r i; do \ - if ! echo "$${i}" | grep -- "- '$${GIT_NEXT_TAG}'" >/dev/null; then \ - echo "[ERR] New Tag required in .github/workflows/nightly.yml: $${GIT_NEXT_TAG}"; \ - exit 1; \ - else \ - echo "[OK] Git Tag present in .github/workflows/nightly.yml: $${GIT_NEXT_TAG}"; \ - fi \ - done # ------------------------------------------------------------------------------------------------- -# Build Targets +# Docker Targets # ------------------------------------------------------------------------------------------------- .PHONY: build -build: - docker build --platform=$(ARCH) $(NO_CACHE) -t $(IMAGE) -f $(DIR)/$(FILE) $(DIR) - ./build/gen-readme.sh $(IMAGE) $(ARCH) +build: ARGS=--build-arg ARCH=$(ARCH) +build: docker-arch-build .PHONY: rebuild -rebuild: NO_CACHE=--no-cache -rebuild: pull-base-image -rebuild: build +rebuild: ARGS=--build-arg ARCH=$(ARCH) +rebuild: docker-arch-rebuild + +.PHONY: push +push: docker-arch-push # ------------------------------------------------------------------------------------------------- # Manifest Targets # ------------------------------------------------------------------------------------------------- .PHONY: manifest-create -manifest-create: - @echo "docker manifest create \ - $(IMAGE):$(TAG) \ - $$( echo $(ARCH) | sed 's/,/ /g' | sed 's|/|-|g' | xargs -n1 sh -c 'printf -- " --amend $(IMAGE):$(TAG)-manifest-$${1}"' -- )" \ - | sed 's/\s\s*/ /g' \ - | sed 's/--/\\\n --/g' - @echo "docker manifest create \ - $(IMAGE):$(TAG) \ - $$( echo $(ARCH) | sed 's/,/ /g' | sed 's|/|-|g' | xargs -n1 sh -c 'printf -- " --amend $(IMAGE):$(TAG)-manifest-$${1}"' -- )" \ - | bash +manifest-create: docker-manifest-create .PHONY: manifest-push -manifest-push: - docker manifest push $(IMAGE):$(TAG) +manifest-push: docker-manifest-push # ------------------------------------------------------------------------------------------------- @@ -100,40 +81,7 @@ manifest-push: # ------------------------------------------------------------------------------------------------- .PHONY: test test: - ./tests/start-ci.sh $(IMAGE) $(ARCH) + ./tests/start-ci.sh $(IMAGE) $(NAME) $(VERSION) $(DOCKER_TAG) $(ARCH) .PHONY: update-readme - ./build/gen-readme.sh $(IMAGE) $(ARCH) - -# ------------------------------------------------------------------------------------------------- -# Deploy Targets -# ------------------------------------------------------------------------------------------------- -.PHONY: tag -tag: - docker tag $(IMAGE) $(IMAGE):$(TAG) - -.PHONY: login -login: - yes | docker login --username $(USER) --password $(PASS) - -.PHONY: push -push: - @$(MAKE) tag TAG=$(TAG) - docker push $(IMAGE):$(TAG) - -.PHONY: push-arch -push-arch: - $(MAKE) tag TAG=$(TAG)-manifest-$(subst /,-,$(ARCH)) - docker push $(IMAGE):$(TAG)-manifest-$(subst /,-,$(ARCH)) - - -# ------------------------------------------------------------------------------------------------- -# Helper Targets -# ------------------------------------------------------------------------------------------------- -.PHONY: enter -enter: - docker run --rm --platform=$(ARCH) -it --entrypoint=bash $(ARG) $(IMAGE) - -.PHONY: pull-base-image -pull-base-image: - @docker pull $(shell grep FROM Dockerfile | sed 's/^FROM\s*//g';) + ./build/gen-readme.sh $(IMAGE) $(NAME) $(VERSION) $(DOCKER_TAG) $(ARCH) diff --git a/README.md b/README.md index 6588e1f..cae85dd 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ This Docker container adds a lot of injectables in order to customize it to your | MAIN_VHOST_SSL_TYPE | string | `plain` |
plain
- only serve via httpssl
- only serve via httpsboth
- serve via http and httpsredir
- serve via https and redirect http to https