diff --git a/Makefile b/Makefile index bbb5267..a4baf94 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,9 @@ IMAGE="invoiceninja" # Check if v5 tag is passed, so that a v5 version should be built IS_V5=$(shell echo ${TAG} | egrep ^5) +# Version of Invoice Ninja. As the tag can be something like 5.0.4-p1, the version is 5.0.4. +# This supports changes to the Dockerfiles with always the same Invoice Ninja version +VERSION=$(shell echo ${TAG} | sed "s/-.*//") # Building docker images based on alpine. # Assigned tags: @@ -19,10 +22,10 @@ IS_V5=$(shell echo ${TAG} | egrep ^5) .PHONY: build-alpine build-alpine: ifeq ($(IS_V5),) - $(info Make: Building "$(TAG)" tagged images from alpine.) - @docker build -t ${HUB_NAMESPACE}/${IMAGE}:alpine-${TAG} --build-arg INVOICENINJA_VERSION=${TAG} --file ./alpine/Dockerfile . + $(info Make: Building "$(VERSION)" tagged images from alpine.) + @docker build -t ${HUB_NAMESPACE}/${IMAGE}:alpine-${VERSION} --build-arg INVOICENINJA_VERSION=${VERSION} --file ./alpine/Dockerfile . # Tag as alpine-4 - @docker tag ${HUB_NAMESPACE}/${IMAGE}:alpine-${TAG} ${HUB_NAMESPACE}/${IMAGE}:alpine-4 + @docker tag ${HUB_NAMESPACE}/${IMAGE}:alpine-${VERSION} ${HUB_NAMESPACE}/${IMAGE}:alpine-4 $(info Make: Done.) endif @@ -30,7 +33,7 @@ endif push-alpine: ifeq ($(IS_V5),) $(info Make: Pushing tagged images from alpine.) - @docker push ${HUB_NAMESPACE}/${IMAGE}:alpine-${TAG} + @docker push ${HUB_NAMESPACE}/${IMAGE}:alpine-${VERSION} @docker push ${HUB_NAMESPACE}/${IMAGE}:alpine-4 $(info Make: Done.) endif @@ -38,10 +41,10 @@ endif .PHONY: build-alpine-v5 build-alpine-v5: ifneq ($(IS_V5),) - $(info Make: Building "$(TAG)" tagged images from alpine.) - @docker build -t ${HUB_NAMESPACE}/${IMAGE}:${TAG} --build-arg INVOICENINJA_VERSION=${TAG} --file ./alpine/Dockerfile_v5 . - @docker tag ${HUB_NAMESPACE}/${IMAGE}:${TAG} ${HUB_NAMESPACE}/${IMAGE}:5 - @docker tag ${HUB_NAMESPACE}/${IMAGE}:${TAG} ${HUB_NAMESPACE}/${IMAGE}:latest + $(info Make: Building "$(VERSION)" tagged images from alpine.) + @docker build -t ${HUB_NAMESPACE}/${IMAGE}:${VERSION} --build-arg INVOICENINJA_VERSION=${VERSION} --file ./alpine/Dockerfile_v5 . + @docker tag ${HUB_NAMESPACE}/${IMAGE}:${VERSION} ${HUB_NAMESPACE}/${IMAGE}:5 + @docker tag ${HUB_NAMESPACE}/${IMAGE}:${VERSION} ${HUB_NAMESPACE}/${IMAGE}:latest $(info Make: Done.) endif @@ -49,7 +52,7 @@ endif push-alpine-v5: ifneq ($(IS_V5),) $(info Make: Pushing tagged images from alpine.) - @docker push ${HUB_NAMESPACE}/${IMAGE}:${TAG} + @docker push ${HUB_NAMESPACE}/${IMAGE}:${VERSION} @docker push ${HUB_NAMESPACE}/${IMAGE}:5 @docker push ${HUB_NAMESPACE}/${IMAGE}:latest endif diff --git a/alpine/Dockerfile_v5 b/alpine/Dockerfile_v5 index dea6d6e..f44bc39 100644 --- a/alpine/Dockerfile_v5 +++ b/alpine/Dockerfile_v5 @@ -43,6 +43,8 @@ RUN chmod +x /usr/local/bin/docker-entrypoint RUN set -eux; \ apk add --no-cache \ + nodejs \ + npm \ freetype-dev \ gmp-dev \ libjpeg-turbo-dev \ @@ -92,4 +94,4 @@ ENV APP_ENV production ENV LOG errorlog ENTRYPOINT ["docker-entrypoint"] -CMD ["php-fpm"] \ No newline at end of file +CMD ["php-fpm"] diff --git a/config/caddy/Caddyfile b/config/caddy/Caddyfile index 6ce150f..6ded1e4 100644 --- a/config/caddy/Caddyfile +++ b/config/caddy/Caddyfile @@ -2,6 +2,5 @@ root * /var/www/app/public php_fastcgi app:9000 encode zstd gzip - templates file_server browse } diff --git a/entrypoint.sh b/entrypoint.sh index 2b62f94..16e9dd0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,16 +12,9 @@ in_error() { exit 1 } -# Indirect expansion (ie) is not supported in bourne shell. That's why we are using this clunkiness here. +# Indirect expansion (ie) is not supported in bourne shell. That's why we are using this "magic" here. ie_gv() { - local line name value - set | \ - while read line; do - name=${line%=*} value=${line#*=\'} - if [ "$name" = "$1" ]; then - echo ${value%\'} - fi - done + eval "echo \$$1" } # usage: file_env VAR [DEFAULT] @@ -37,7 +30,7 @@ file_env() { in_error "Both $var and $fileVar are set (but are exclusive)" fi - local val="$def" + local val="$def" if [ "$(ie_gv ${var})" != "" ]; then val=$(ie_gv ${var}) elif [ "$(ie_gv ${fileVar})" != "" ]; then