Compare commits
14 commits
Author | SHA1 | Date | |
---|---|---|---|
81f17b5027 | |||
e8e2761cff | |||
a1f8d62549 | |||
50393ac177 | |||
7333c7bcf5 | |||
197cd684c0 | |||
553dfaced3 | |||
6c798da8ae | |||
31aad6ef5f | |||
5f9aa6d38c | |||
5b011a361b | |||
035c4929df | |||
a3dc2a0b02 | |||
59fd6632aa |
3 changed files with 40 additions and 15 deletions
|
@ -1,6 +1,6 @@
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine-perl
|
||||||
|
|
||||||
RUN apk add --upgrade --no-cache gettext inotify-tools
|
RUN apk add --upgrade --no-cache bash gettext inotify-tools
|
||||||
RUN mv /etc/nginx /etc/nginx.tmpl
|
RUN mv /etc/nginx /etc/nginx.tmpl
|
||||||
RUN touch /etc/envsubst.conf
|
RUN touch /etc/envsubst.conf
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,27 @@ resources:
|
||||||
source:
|
source:
|
||||||
uri: https://gitea.redxef.at/redxef/nginx-envsubst
|
uri: https://gitea.redxef.at/redxef/nginx-envsubst
|
||||||
branch: master
|
branch: master
|
||||||
|
fetch_tags: true
|
||||||
- name: upstream-image
|
- name: upstream-image
|
||||||
type: registry-image
|
type: registry-image
|
||||||
|
check_every: 6h
|
||||||
source:
|
source:
|
||||||
repository: alpine
|
repository: nginx
|
||||||
|
tag: alpine
|
||||||
|
- name: image
|
||||||
|
type: oci-image
|
||||||
|
source:
|
||||||
|
repository: redxef/nginx-envsubst
|
||||||
|
tag: latest
|
||||||
|
username: ((docker.username))
|
||||||
|
password: ((docker.password))
|
||||||
|
|
||||||
|
resource_types:
|
||||||
|
- name: oci-image
|
||||||
|
type: registry-image
|
||||||
|
source:
|
||||||
|
repository: redxef/concourse-oci-resource
|
||||||
|
tag: latest
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- name: build-push
|
- name: build-push
|
||||||
|
@ -51,16 +68,18 @@ jobs:
|
||||||
- name: source
|
- name: source
|
||||||
path: .
|
path: .
|
||||||
- name: docker-tags
|
- name: docker-tags
|
||||||
|
outputs:
|
||||||
|
- name: build-output
|
||||||
params:
|
params:
|
||||||
username: ((docker.username))
|
dest: build-output/image.tar
|
||||||
password: ((docker.password))
|
|
||||||
repository: docker.io/redxef/nginx-envsubst
|
|
||||||
tag: latest
|
|
||||||
additional_tags: docker-tags/tags.txt
|
|
||||||
push: true
|
|
||||||
platform: aarch64,arm,i386,ppc64le,s390x,x86_64
|
platform: aarch64,arm,i386,ppc64le,s390x,x86_64
|
||||||
context: .
|
|
||||||
manual: false
|
|
||||||
run:
|
run:
|
||||||
path: build
|
path: build
|
||||||
|
- put: image
|
||||||
|
inputs:
|
||||||
|
- build-output
|
||||||
|
- docker-tags
|
||||||
|
params:
|
||||||
|
image: build-output/image.tar
|
||||||
|
additional_tags: docker-tags/tags.txt
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
pids=""
|
pids=""
|
||||||
|
|
||||||
|
@ -36,10 +36,16 @@ run_nginx() {
|
||||||
}
|
}
|
||||||
|
|
||||||
run_inotifywait() {
|
run_inotifywait() {
|
||||||
while find "$dstdir" -type f -exec \
|
while :; do
|
||||||
sed -En '/ssl_certificate/ s/^\s*ssl_certificate(_key)? (.*);.*$/\2/p' {} \; | sort | uniq | \
|
wait_files="$(find "$dstdir" -type f -exec \
|
||||||
inotifywait --fromfile=-; do
|
sed -En '/ssl_certificate/ s/^\s*ssl_certificate(_key)? (.*);.*$/\2/p' {} \; | sort -u)"
|
||||||
|
wait_directories="$(echo "$wait_files" | xargs -n 1 dirname | sort -u)"
|
||||||
|
echo "monitoring the following files:"
|
||||||
|
echo "$wait_files"
|
||||||
|
matched_files="$(echo "$wait_directories" | inotifywait --fromfile=- -e close_write -e modify -e create)"
|
||||||
|
if [[ -n "$(comm -12 <(sort -u <<< "$matched_files") <(echo "$wait_files"))" ]]; then
|
||||||
nginx -s reload
|
nginx -s reload
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue