Update dev proxy
This commit is contained in:
parent
bb10ae775e
commit
2e89c4bb39
@ -1,18 +1,18 @@
|
||||
DOCKER_REGISTRY = dr.ys-dev.cz
|
||||
DOCKER_PUBLIC_REGISTRY = yoursystemcz
|
||||
APP_NAME = dev-proxy
|
||||
|
||||
APP_VERSION = 2.0
|
||||
|
||||
|
||||
all: build release
|
||||
|
||||
|
||||
build:
|
||||
docker build -t $(DOCKER_REGISTRY)/$(APP_NAME):latest --build-arg "IMAGE_NAME=nimmis/alpine" --build-arg "IMAGE_VERSION=3.8" ./src
|
||||
docker build -t $(DOCKER_REGISTRY)/$(APP_NAME):$(APP_VERSION) ./src
|
||||
|
||||
tag:
|
||||
docker tag $(DOCKER_REGISTRY)/$(APP_NAME):latest $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):latest
|
||||
docker tag $(DOCKER_REGISTRY)/$(APP_NAME):$(APP_VERSION) $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):$(APP_VERSION)
|
||||
|
||||
release: tag
|
||||
docker push $(DOCKER_REGISTRY)/$(APP_NAME):latest
|
||||
docker push $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):latest
|
||||
docker push $(DOCKER_REGISTRY)/$(APP_NAME):$(APP_VERSION)
|
||||
docker push $(DOCKER_PUBLIC_REGISTRY)/$(APP_NAME):$(APP_VERSION)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
|
||||
|
||||
IMAGE_NAME="yoursystemcz/dev-proxy"
|
||||
IMAGE_VERSION="latest"
|
||||
IMAGE_VERSION="2.0"
|
||||
|
||||
SERVICE_NAME=dev-proxy
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
FROM alpine:3.8
|
||||
FROM alpine:3.12
|
||||
|
||||
ARG CADDY_VERSION="0.11.1"
|
||||
ARG CADDY_VERSION="2.2.0"
|
||||
ARG FOREGO_VERSION="0.16.1"
|
||||
ARG DOCKER_GEN_VERSION="0.7.4"
|
||||
|
||||
@ -32,13 +32,13 @@ RUN wget --quiet "https://github.com/jwilder/docker-gen/releases/download/$DOCKE
|
||||
|
||||
RUN curl --silent --show-error --fail --location \
|
||||
--header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \
|
||||
"https://github.com/mholt/caddy/releases/download/v${CADDY_VERSION}/caddy_v${CADDY_VERSION}_linux_amd64.tar.gz" \
|
||||
"https://github.com/mholt/caddy/releases/download/v${CADDY_VERSION}/caddy_${CADDY_VERSION}_linux_amd64.tar.gz" \
|
||||
| tar --no-same-owner -C /usr/bin -xz \
|
||||
&& chmod 0755 /usr/bin/caddy \
|
||||
&& /usr/bin/caddy -version \
|
||||
&& /usr/bin/caddy version \
|
||||
&& apk del .build-dependencies
|
||||
|
||||
EXPOSE 80 443 2015
|
||||
EXPOSE 80 443
|
||||
VOLUME /etc/caddy
|
||||
|
||||
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
dockergen: docker-gen -notify-output -config /code/docker-gen/config/docker-gen.cfg
|
||||
caddy: caddy --conf /etc/caddy/Caddyfile --log stdout
|
||||
caddy: caddy run --config /etc/caddy/Caddyfile --watch
|
||||
|
||||
@ -4,4 +4,3 @@ dest = "/etc/caddy/Caddyfile"
|
||||
onlyexposed = false
|
||||
watch = true
|
||||
wait = "500ms:2s"
|
||||
notifycmd = "pkill -USR1 caddy"
|
||||
|
||||
@ -4,46 +4,55 @@
|
||||
|
||||
{{ if not $hosts }}
|
||||
|
||||
127.0.0.1:2015
|
||||
127.0.0.1:80
|
||||
log stdout
|
||||
errors stderr
|
||||
|
||||
{{ else }}
|
||||
|
||||
{
|
||||
auto_https disable_redirects
|
||||
local_certs
|
||||
}
|
||||
{{ range $host, $containers := $hosts }}
|
||||
{{ $c := first $containers }}
|
||||
{{ $tlsOff := trim (index $c.Env "VIRTUAL_DISABLE_TLS") }}
|
||||
{{ $port := coalesce $c.Env.VIRTUAL_PORT "80" }}
|
||||
|
||||
http://{{ $host }}, https://{{ $host }} {
|
||||
tls self_signed
|
||||
tls internal
|
||||
|
||||
reverse_proxy * {
|
||||
header_up X-Real-IP {http.request.remote}
|
||||
header_up X-Forwarded-Port {http.request.port}
|
||||
header_up X-Forwarded-Proto {http.request.scheme}
|
||||
|
||||
flush_interval -1
|
||||
|
||||
proxy / {
|
||||
policy round_robin
|
||||
transparent
|
||||
websocket
|
||||
header_upstream Host {host}
|
||||
header_upstream X-Real-IP {remote}
|
||||
header_upstream X-Forwarded-For {remote}
|
||||
header_upstream X-Forwarded-Proto {scheme}
|
||||
{{ range $i, $container := $containers }}
|
||||
{{ $addrLen := len $container.Addresses }}
|
||||
{{ range $knownNetwork := $CurrentContainer.Networks }}
|
||||
{{ range $containerNetwork := $container.Networks }}
|
||||
{{ if (and (and (ne $containerNetwork.Name "ingress") (ne $containerNetwork.Name "bridge")) (or (eq $knownNetwork.Name $containerNetwork.Name) (eq $knownNetwork.Name "host"))) }}
|
||||
## Can be connected with "{{ $containerNetwork.Name }}" network
|
||||
upstream {{ $containerNetwork.IP }}:{{ $port }}
|
||||
to {{ $containerNetwork.IP }}:{{ $port }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
}
|
||||
|
||||
gzip {
|
||||
not /__webpack_hmr
|
||||
|
||||
@hmr {
|
||||
not {
|
||||
path /__webpack_hmr
|
||||
}
|
||||
}
|
||||
|
||||
encode @hmr gzip
|
||||
|
||||
log {
|
||||
output stdout
|
||||
}
|
||||
log stdout
|
||||
errors stderr
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user