From 3f2bd1604edef635b97c65f65f4eaac52022a994 Mon Sep 17 00:00:00 2001 From: cytopia Date: Sat, 12 Dec 2020 16:37:23 +0100 Subject: [PATCH 1/5] Migrate from Travis CI to GitHub Actions --- .github/workflows/build.yml | 163 ++++++++++++++++++++++++++++++++ .github/workflows/lint.yml | 38 ++++++++ .github/workflows/nightly.yml | 169 ++++++++++++++++++++++++++++++++++ .travis.yml | 101 -------------------- Makefile | 99 +++++++++++++++++--- README.md | 5 +- 6 files changed, 458 insertions(+), 117 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/nightly.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..28e1a1a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,163 @@ +--- + +# ------------------------------------------------------------------------------------------------- +# Job Name +# ------------------------------------------------------------------------------------------------- +name: build + + +# ------------------------------------------------------------------------------------------------- +# When to run +# ------------------------------------------------------------------------------------------------- +on: + # Runs on Pull Requests + pull_request: + # Runs on Push + push: + + +# ------------------------------------------------------------------------------------------------- +# What to run +# ------------------------------------------------------------------------------------------------- +jobs: + build: + name: "[ HTTPD ]" + runs-on: ubuntu-latest + steps: + + # ------------------------------------------------------------ + # Setup repository + # ------------------------------------------------------------ + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set variables + id: vars + run: | + + # Retrieve git info (tags, etc) + git fetch --all + + # Branch, Tag or Commit + GIT_TYPE="$( \ + curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \ + | sh \ + | grep '^GIT_TYPE' \ + | sed 's|.*=||g' \ + )" + # Branch name, Tag name or Commit Hash + GIT_SLUG="$( \ + curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \ + | sh \ + | grep '^GIT_NAME' \ + | sed 's|.*=||g' \ + )" + # Docker Tag + if [ "${GIT_TYPE}" = "BRANCH" ] && [ "${GIT_SLUG}" = "master" ]; then + DOCKER_TAG="latest" + else + DOCKER_TAG="${GIT_SLUG}" + fi + + # Output + echo "GIT_TYPE=${GIT_TYPE}" + echo "GIT_SLUG=${GIT_SLUG}" + echo "DOCKER_TAG=${DOCKER_TAG}" + + # Export variable + # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files + echo "GIT_TYPE=${GIT_TYPE}" >> ${GITHUB_ENV} + echo "GIT_SLUG=${GIT_SLUG}" >> ${GITHUB_ENV} + echo "DOCKER_TAG=${DOCKER_TAG}" >> ${GITHUB_ENV} + + + # ------------------------------------------------------------ + # Build + # ------------------------------------------------------------ + - name: Build + run: | + retry() { + for n in $(seq ${RETRIES}); do + echo "[${n}/${RETRIES}] ${*}"; + if eval "${*}"; then + echo "[SUCC] ${n}/${RETRIES}"; + return 0; + fi; + sleep ${PAUSE}; + echo "[FAIL] ${n}/${RETRIES}"; + done; + return 1; + } + retry make build + env: + RETRIES: 20 + PAUSE: 10 + + # ------------------------------------------------------------ + # Test + # ------------------------------------------------------------ + - name: Test Docker Image + run: | + retry() { + for n in $(seq ${RETRIES}); do + echo "[${n}/${RETRIES}] ${*}"; + if eval "${*}"; then + echo "[SUCC] ${n}/${RETRIES}"; + return 0; + fi; + sleep ${PAUSE}; + echo "[FAIL] ${n}/${RETRIES}"; + done; + return 1; + } + retry make test + env: + RETRIES: 20 + PAUSE: 10 + + + # ------------------------------------------------------------ + # Deploy + # ------------------------------------------------------------ + - name: Publish images (only repo owner) + run: | + retry() { + for n in $(seq ${RETRIES}); do + echo "[${n}/${RETRIES}] ${*}"; + if eval "${*}"; then + echo "[SUCC] ${n}/${RETRIES}"; + return 0; + fi; + sleep ${PAUSE}; + echo "[FAIL] ${n}/${RETRIES}"; + done; + return 1; + } + + # Output + echo "GIT_TYPE=${GIT_TYPE}" + echo "GIT_SLUG=${GIT_SLUG}" + echo "DOCKER_TAG=${DOCKER_TAG}" + + # Tag image + retry make tag TAG=${DOCKER_TAG} + docker images + + # Login and Push + retry make login USER=${{ secrets.DOCKERHUB_USERNAME }} PASS=${{ secrets.DOCKERHUB_PASSWORD }} + retry make push TAG=${DOCKER_TAG} + + env: + RETRIES: 20 + PAUSE: 10 + # 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/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..5290e4c --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,38 @@ +--- + +# ------------------------------------------------------------------------------------------------- +# Job Name +# ------------------------------------------------------------------------------------------------- +name: lint + + +# ------------------------------------------------------------------------------------------------- +# When to run +# ------------------------------------------------------------------------------------------------- +on: + # Runs on Pull Requests + pull_request: + + +# ------------------------------------------------------------------------------------------------- +# What to run +# ------------------------------------------------------------------------------------------------- +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 + run: | + make lint-workflow diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..e5ec9e8 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,169 @@ +--- + +# ------------------------------------------------------------------------------------------------- +# Job Name +# ------------------------------------------------------------------------------------------------- +name: nightly + + +# ------------------------------------------------------------------------------------------------- +# When to run +# ------------------------------------------------------------------------------------------------- +on: + # Runs daily + schedule: + - cron: '0 0 * * *' + + +# ------------------------------------------------------------------------------------------------- +# What to run +# ------------------------------------------------------------------------------------------------- +jobs: + nightly: + name: "[ HTTPD ] (ref: ${{ matrix.refs }})" + runs-on: ubuntu-latest + strategy: + fail-fast: False + matrix: + refs: + - 'master' + - '0.36' + steps: + + # ------------------------------------------------------------ + # Setup repository + # ------------------------------------------------------------ + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: ${{ matrix.refs }} + + - name: Set variables + id: vars + run: | + + # Retrieve git info (tags, etc) + git fetch --all + + # Branch, Tag or Commit + GIT_TYPE="$( \ + curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \ + | sh \ + | grep '^GIT_TYPE' \ + | sed 's|.*=||g' \ + )" + # Branch name, Tag name or Commit Hash + GIT_SLUG="$( \ + curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \ + | sh \ + | grep '^GIT_NAME' \ + | sed 's|.*=||g' \ + )" + # Docker Tag + if [ "${GIT_TYPE}" = "BRANCH" ] && [ "${GIT_SLUG}" = "master" ]; then + DOCKER_TAG="latest" + else + DOCKER_TAG="${GIT_SLUG}" + fi + + # Output + echo "GIT_TYPE=${GIT_TYPE}" + echo "GIT_SLUG=${GIT_SLUG}" + echo "DOCKER_TAG=${DOCKER_TAG}" + + # Export variable + # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files + echo "GIT_TYPE=${GIT_TYPE}" >> ${GITHUB_ENV} + echo "GIT_SLUG=${GIT_SLUG}" >> ${GITHUB_ENV} + echo "DOCKER_TAG=${DOCKER_TAG}" >> ${GITHUB_ENV} + + + # ------------------------------------------------------------ + # Build + # ------------------------------------------------------------ + - name: Build + run: | + retry() { + for n in $(seq ${RETRIES}); do + echo "[${n}/${RETRIES}] ${*}"; + if eval "${*}"; then + echo "[SUCC] ${n}/${RETRIES}"; + return 0; + fi; + sleep ${PAUSE}; + echo "[FAIL] ${n}/${RETRIES}"; + done; + return 1; + } + retry make build + env: + RETRIES: 20 + PAUSE: 10 + + # ------------------------------------------------------------ + # Test + # ------------------------------------------------------------ + - name: Test Docker Image + run: | + retry() { + for n in $(seq ${RETRIES}); do + echo "[${n}/${RETRIES}] ${*}"; + if eval "${*}"; then + echo "[SUCC] ${n}/${RETRIES}"; + return 0; + fi; + sleep ${PAUSE}; + echo "[FAIL] ${n}/${RETRIES}"; + done; + return 1; + } + retry make test + env: + RETRIES: 20 + PAUSE: 10 + + + # ------------------------------------------------------------ + # Deploy + # ------------------------------------------------------------ + - name: Publish images (only repo owner) + run: | + retry() { + for n in $(seq ${RETRIES}); do + echo "[${n}/${RETRIES}] ${*}"; + if eval "${*}"; then + echo "[SUCC] ${n}/${RETRIES}"; + return 0; + fi; + sleep ${PAUSE}; + echo "[FAIL] ${n}/${RETRIES}"; + done; + return 1; + } + + # Output + echo "GIT_TYPE=${GIT_TYPE}" + echo "GIT_SLUG=${GIT_SLUG}" + echo "DOCKER_TAG=${DOCKER_TAG}" + + # Tag image + retry make tag TAG=${DOCKER_TAG} + docker images + + # Login and Push + retry make login USER=${{ secrets.DOCKERHUB_USERNAME }} PASS=${{ secrets.DOCKERHUB_PASSWORD }} + retry make push TAG=${DOCKER_TAG} + + env: + RETRIES: 20 + PAUSE: 10 + # 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/.travis.yml b/.travis.yml deleted file mode 100644 index 00fd266..0000000 --- a/.travis.yml +++ /dev/null @@ -1,101 +0,0 @@ -### -### Enable sudo (required for docker service) -### -sudo: required - - -### -### Language -### -language: python - - -### -### Add services -### -services: - - docker - - -### -### Build Matrix definition -### -env: - global: - - IMAGE=devilbox/nginx-stable - # travis encrypt DOCKER_USERNAME=user - # travis encrypt DOCKER_PASSWORD=pass - # Must be regenerated when repository name/owner changes - # DOCKER_USERNAME - - secure: "JSBXf4UJN2E0xBINmtVPPkFL27P1s/f3z/Gpl4009ko1lQk6GCDZlzDlA20M43Sg51drV9nq+H5zjwMNrI1AQ6oiEnW8/H3LNfQE4ooO/sHdmpjA2P286sldgiZTx2MB9mp+3FUdf3+corTS0HJ9Gi5pb2FSdau36rkdlHHXmZ/rRatwLOVQCUibdbwnQTv5ayBAJixr9vboDjS55iJxHNWMx9QdYEKaNe/pizSSDLqM8RddMaJZCV1TNMAESHQqA5YvWxI2+ApsY4BnzRF+JgK7EnogYWdAuoybqMcBmK7+FH/aqPozPPxOL7qOl/VB+Bi8/mr8odJS3XoJyTUrdvm7KLSJwPd2z80JqUv7EzgX58+B7Y1Mnw8Sd9GngcNw2j4n2Qx9s/UWzz09KnPlLsiU0XAVNU1jzuwyPUg2MV54/176za61697C/CL4gW6B+JglBGRQmA1oanKty51Bu2bmxnP7lFH8koYBHNjLV30qw/nRlXcNAMviUannBcnEyayPtwUw2EEKQQIzmSPkBcv3AVnBPfdrAVinY4S/ll+q2FlVvFjqUUsDZKFhAw0hls6iH/fUw7UnckddP7bqfvBUmwMHhskoo8lu0bV1Owk4lBqmUFJkQcHl+0zvVythBjRCyktrvTLAjfvS/7HdxQPIat0K/O7J9Jbhg7UJdzQ=" - # DOCKER_PASSWORD - - secure: "edwTPNiI46GqX1wCVhN1xfrE1QEvDImEDz/aL2DYZo/W5Y3h4Y7HzJh4E8nb0gtYeJmoNRpDde/mTxDFtzOX0EzcAygjKrwbxEO063/Y2x6odIcRV/XU+OPnTpLL1jwQsb+kWgdTnl1E/Y5IO+8+Dhlb4l4tvRC50r4sU8iDZFXNj5B5SRzAXTlERkccL83JxA8qGRn9u8+w97vglMyXK4/fnae4KIb6pcv3flkiw//uq5lQyqdIbLqxa+aY99zatgmmYcrum5WiuSBWHdUMaB4W6KulvGnrUWYujQldTAQ8967stWbWta+qMQ2G3hFfA80mmmJo2U0R+IHocvrhQczxcVja7Lcqfqs/6SSlK0vO3U5XV/jBYhHAj8jjKAQI0Z9sRvK6cnH/MXxzJLtnpYC/AB+CL7Ou1PQLVVxZ/0gXmRFgg4oOXmdupymBpI8zQanJ9VvLfljephLs5MeR6994ZJQJ8/mG/HGxh2yempN0NED2jZZjnqXbsWCimjeNN0hhKhEQFZZ5654aG62eWKhfaI1ril7lc2ba8VnMeRTEE7htM4wfhEHVdiXdpir8zfn8sydHvmaH/vO+M3zuCTKJg9MwBvzuANQBy5Ae9YtMzHETM86wfXqZ1e5E0iaWYccZaeGSGIpS8mIpt5uwDOPMRaL4teJ4SNzlZEa7XBM=" - matrix: - - TEST=0 - - TEST=1 - - -### -### Stage definitions -### -stages: - - test - - deploy - - -### -### Global for all stages -### -install: - # Get newer docker version - - max=100; i=0; while [ $i -lt $max ]; do if sudo apt-get update; then break; else i=$((i+1)); fi done - - max=100; i=0; while [ $i -lt $max ]; do if sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce; then break; else i=$((i+1)); fi done - - docker version -script: - - make build - - make test ARG=${TEST} - - -### -### Job definitions -### -jobs: - include: - # Final deploy stage - - stage: deploy - env: TEST= - before_script: - - if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then - if [ -n "${TRAVIS_TAG}" ]; then - docker build --no-cache=true -t "${IMAGE}:${TRAVIS_TAG}" . && - docker images; - elif [ "${TRAVIS_BRANCH}" == "master" ]; then - docker build --no-cache=true -t "${IMAGE}:latest" . && - docker images; - elif [[ ${TRAVIS_BRANCH} =~ ^(release-[.0-9]+)$ ]]; then - docker build --no-cache=true -t "${IMAGE}:${TRAVIS_BRANCH}" . && - docker images; - else - echo "Skipping branch ${TRAVIS_BRANCH}"; - fi - fi - script: - # Push to docker hub on success - - if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then - echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin && - if [ -n "${TRAVIS_TAG}" ]; then - echo "Pushing ${IMAGE}:${TRAVIS_TAG}" && - docker push "${IMAGE}:${TRAVIS_TAG}" && - docker tag "${IMAGE}:${TRAVIS_TAG}" "${IMAGE}:latest" && - echo "Pushing ${IMAGE}:latest" && - docker push "${IMAGE}:latest"; - elif [ "${TRAVIS_BRANCH}" == "master" ]; then - echo "Pushing ${IMAGE}:latest" && - docker push "${IMAGE}:latest"; - elif [[ ${TRAVIS_BRANCH} =~ ^(release-[.0-9]+)$ ]]; then - echo "Pushing ${IMAGE}:${TRAVIS_BRANCH}" && - docker push "${IMAGE}:${TRAVIS_BRANCH}"; - else - echo "Skipping branch ${TRAVIS_BRANCH}"; - fi - fi diff --git a/Makefile b/Makefile index 0361331..ad05e72 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,93 @@ -image = devilbox/nginx-stable +ifneq (,) +.error This Makefile requires GNU Make. +endif + + +# ------------------------------------------------------------------------------------------------- +# Docker configuration +# ------------------------------------------------------------------------------------------------- + +IMAGE = devilbox/nginx-stable +TAG = latest + + +# ------------------------------------------------------------------------------------------------- +# Default Target +# ------------------------------------------------------------------------------------------------- help: - @printf "%s\n" "make build: Build" - @printf "%s\n" "make rebuild: Rebuild" - @printf "%s\n" "make test: Test" + @echo "lint Lint project files and repository" + @echo "build Build Docker image" + @echo "rebuild Build Docker image without cache" + @echo "test Test built Docker image" + @echo "update-readme Update README.md with PHP modules" + @echo "tag [TAG=...] Retag Docker image" + @echo "login USER=... PASS=... Login to Docker hub" + @echo "push [TAG=...] Push Docker image to Docker hub" -build: pull - docker build -t $(image) . - cd build; ./gen-readme.sh $(image) +# ------------------------------------------------------------------------------------------------- +# Lint Targets +# ------------------------------------------------------------------------------------------------- -rebuild: pull - docker build --no-cache -t $(image) . - cd build; ./gen-readme.sh $(image) +lint: 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 ))"; \ + if ! grep 'refs:' -A 100 .github/workflows/nightly.yml \ + | 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 + + +# ------------------------------------------------------------------------------------------------- +# Build Targets +# ------------------------------------------------------------------------------------------------- + +build: pull-base-image + docker build -t $(IMAGE) . + cd build; ./gen-readme.sh $(IMAGE) + +rebuild: pull-base-image + docker build --no-cache -t $(IMAGE) . + cd build; ./gen-readme.sh $(IMAGE) -tag: - docker tag $(image) $(image):$(ARG) + +# ------------------------------------------------------------------------------------------------- +# Test Targets +# ------------------------------------------------------------------------------------------------- test: - .ci/start-ci.sh $(image) $(ARG) + .ci/start-ci.sh $(IMAGE) $(ARG) + + +# ------------------------------------------------------------------------------------------------- +# Deploy Targets +# ------------------------------------------------------------------------------------------------- + +tag: + docker tag $(IMAGE) $(IMAGE):$(TAG) + +login: + yes | docker login --username $(USER) --password $(PASS) + +push: + @$(MAKE) tag TAG=$(TAG) + docker push $(IMAGE):$(TAG) + + +# ------------------------------------------------------------------------------------------------- +# Helper Targets +# ------------------------------------------------------------------------------------------------- + +enter: + docker run --rm --name $(subst /,-,$(IMAGE)) -it --entrypoint=bash $(ARG) $(IMAGE) -pull: - docker pull $(shell grep 'FROM' Dockerfile | sed 's/^FROM//g'; ) +pull-base-image: + @docker pull $(shell grep FROM Dockerfile | sed 's/^FROM\s*//g';) diff --git a/README.md b/README.md index dbe17dc..8384ef1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # Nginx stable Docker image -[![Build Status](https://travis-ci.org/devilbox/docker-nginx-stable.svg?branch=master)](https://travis-ci.org/devilbox/docker-nginx-stable) +[![lint](https://github.com/devilbox/docker-nginx-stable/workflows/lint/badge.svg)](https://github.com/devilbox/docker-nginx-stable/actions?query=workflow%3Alint) +[![build](https://github.com/devilbox/docker-nginx-stable/workflows/build/badge.svg)](https://github.com/devilbox/docker-nginx-stable/actions?query=workflow%3Abuild) +[![nightly](https://github.com/devilbox/docker-nginx-stable/workflows/nightly/badge.svg)](https://github.com/devilbox/docker-nginx-stable/actions?query=workflow%3Anightly) + [![release](https://img.shields.io/github/release/devilbox/docker-nginx-stable.svg)](https://github.com/devilbox/docker-nginx-stable/releases) [![Join the chat at https://gitter.im/devilbox/Lobby](https://badges.gitter.im/devilbox/Lobby.svg)](https://gitter.im/devilbox/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Github](https://img.shields.io/badge/github-docker--nginx--stable-red.svg)](https://github.com/devilbox/docker-nginx-stable) From bc00e9e9bd1191d8157bc7029e1610187978efc0 Mon Sep 17 00:00:00 2001 From: cytopia Date: Sat, 12 Dec 2020 16:38:58 +0100 Subject: [PATCH 2/5] Update vhost-gen to latest version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 58de319..16f3c96 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ LABEL \ ### ### Build arguments ### -ARG VHOST_GEN_GIT_REF=0.16 +ARG VHOST_GEN_GIT_REF=1.0.3 ARG CERT_GEN_GIT_REF=0.7 ENV BUILD_DEPS \ From 97a39bee402474dd801c8af93a30696a1f011ccb Mon Sep 17 00:00:00 2001 From: cytopia Date: Sat, 12 Dec 2020 16:46:57 +0100 Subject: [PATCH 3/5] Update watcherd to improve performance --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 16f3c96..2dcf2bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ LABEL \ ### Build arguments ### ARG VHOST_GEN_GIT_REF=1.0.3 +ARG WATCHERD_GIT_REF=v1.0.2 ARG CERT_GEN_GIT_REF=0.7 ENV BUILD_DEPS \ @@ -58,7 +59,7 @@ RUN set -x \ && chmod +x /usr/bin/cert-gen \ \ # Install watcherd - && wget --no-check-certificate -O /usr/bin/watcherd https://raw.githubusercontent.com/devilbox/watcherd/v1.0.1/watcherd \ + && wget --no-check-certificate -O /usr/bin/watcherd https://raw.githubusercontent.com/devilbox/watcherd/${WATCHERD_GIT_REF}/watcherd \ && chmod +x /usr/bin/watcherd \ \ # Clean-up From 10fc62bfc4ea91f2033eb6c5a9881b05500920fc Mon Sep 17 00:00:00 2001 From: cytopia Date: Sat, 12 Dec 2020 17:04:09 +0100 Subject: [PATCH 4/5] Fix vhost creation --- README.md | 2 +- data/create-vhost.sh | 2 +- data/docker-entrypoint.d/07-vhost-gen.sh | 2 +- data/vhost-gen/main.yml | 4 ++-- data/vhost-gen/mass.yml | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8384ef1..092911c 100644 --- a/README.md +++ b/README.md @@ -270,5 +270,5 @@ It allows any of the following combinations: ## Version ``` -nginx version: nginx/1.18.0 +nginx version: nginx/1.18.0 ``` diff --git a/data/create-vhost.sh b/data/create-vhost.sh index b8f58d7..7c8d0bb 100755 --- a/data/create-vhost.sh +++ b/data/create-vhost.sh @@ -30,7 +30,7 @@ if [ "${GENERATE_SSL}" = "1" ]; then fi fi -cmd="vhost_gen.py -p \"${VHOST_PATH}\" -n \"${VHOST_NAME}\" -c /etc/vhost-gen/mass.yml -o \"${VHOST_TPL}\" -s ${VERBOSE} -m ${GEN_MODE}" +cmd="vhost-gen -p \"${VHOST_PATH}\" -n \"${VHOST_NAME}\" -c /etc/vhost-gen/mass.yml -o \"${VHOST_TPL}\" -s ${VERBOSE} -m ${GEN_MODE}" if [ -n "${VERBOSE}" ]; then echo "\$ ${cmd}" fi diff --git a/data/docker-entrypoint.d/07-vhost-gen.sh b/data/docker-entrypoint.d/07-vhost-gen.sh index 30f6f5d..2dc38cb 100755 --- a/data/docker-entrypoint.d/07-vhost-gen.sh +++ b/data/docker-entrypoint.d/07-vhost-gen.sh @@ -94,7 +94,7 @@ vhost_gen_generate_main_vhost() { fi # Adding custom nginx vhost template to ensure paths like: # /vendor/index.php/arg1/arg2 will also work (just like Apache) - run "vhost_gen.py -n localhost -p ${docroot} -t /etc/vhost-gen/templates-main/ -c ${config} -o ${template} ${verbose} -d -s -m ${ssl_type}" "${debug}" + run "vhost-gen -n localhost -p ${docroot} -t /etc/vhost-gen/templates-main/ -c ${config} -o ${template} ${verbose} -d -s -m ${ssl_type}" "${debug}" fi } diff --git a/data/vhost-gen/main.yml b/data/vhost-gen/main.yml index 5b541d1..bb9b324 100644 --- a/data/vhost-gen/main.yml +++ b/data/vhost-gen/main.yml @@ -77,13 +77,13 @@ vhost: ssl_port: 443 # The virtual host name is specified as an command line argument - # to vhost_gen.py via '-n', however it is possible + # to vhost-gen via '-n', however it is possible # to prepend and/or append additional name strings. name: prefix: suffix: # The document root directory is specified as an command line argument - # to vhost_gen.py via '-p', however it is possible + # to vhost-gen via '-p', however it is possible # to prepend another subdirectory here. docroot: suffix: diff --git a/data/vhost-gen/mass.yml b/data/vhost-gen/mass.yml index 19fa910..cc6802d 100644 --- a/data/vhost-gen/mass.yml +++ b/data/vhost-gen/mass.yml @@ -77,13 +77,13 @@ vhost: ssl_port: 443 # The virtual host name is specified as an command line argument - # to vhost_gen.py via '-n', however it is possible + # to vhost-gen via '-n', however it is possible # to prepend and/or append additional name strings. name: prefix: suffix: __TLD__ # The document root directory is specified as an command line argument - # to vhost_gen.py via '-p', however it is possible + # to vhost-gen via '-p', however it is possible # to prepend another subdirectory here. docroot: suffix: __DOCROOT_SUFFIX__ From c121518f2f4987584ac394ea7bdf9b271efff60a Mon Sep 17 00:00:00 2001 From: cytopia Date: Sat, 12 Dec 2020 17:24:18 +0100 Subject: [PATCH 5/5] Fix Readme generation --- Makefile | 4 ++-- README.md | 2 +- build/gen-readme.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ad05e72..b2e4378 100644 --- a/Makefile +++ b/Makefile @@ -52,11 +52,11 @@ lint-workflow: build: pull-base-image docker build -t $(IMAGE) . - cd build; ./gen-readme.sh $(IMAGE) + ./build/gen-readme.sh $(IMAGE) rebuild: pull-base-image docker build --no-cache -t $(IMAGE) . - cd build; ./gen-readme.sh $(IMAGE) + ./build/gen-readme.sh $(IMAGE) # ------------------------------------------------------------------------------------------------- diff --git a/README.md b/README.md index 092911c..8384ef1 100644 --- a/README.md +++ b/README.md @@ -270,5 +270,5 @@ It allows any of the following combinations: ## Version ``` -nginx version: nginx/1.18.0 +nginx version: nginx/1.18.0 ``` diff --git a/build/gen-readme.sh b/build/gen-readme.sh index 32d0154..f913b28 100755 --- a/build/gen-readme.sh +++ b/build/gen-readme.sh @@ -10,7 +10,7 @@ IMAGE="${1}" ### ### Retrieve information afterwards and Update README.md ### -INFO="$( docker run -it --rm --entrypoint=nginx ${IMAGE} -v 2>&1 )" +INFO="$( docker run --rm --entrypoint=nginx "${IMAGE}" -v 2>&1 | tr -d '\r' )" echo "${INFO}" sed -i'' '/##[[:space:]]Version/q' "${CWD}/README.md"