add nginx proxy
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
ENV_VARS += NGINX_DEFAULT_HOST NGINX_SERVICE_80_TAGS NGINX_SERVICE_443_TAGS NGINX_VIRTUAL_HOST
|
||||
NGINX_SERVICE_HOST ?= $(subst $(comma),$(space),$(NGINX_VIRTUAL_HOST))
|
||||
NGINX_SERVICE_PATH ?= /
|
||||
NGINX_SERVICE_80_HOST ?= $(patsubst %,%:80,$(NGINX_SERVICE_HOST))
|
||||
NGINX_SERVICE_80_TAGS ?= $(call tagprefix,nginx,80,host)
|
||||
NGINX_SERVICE_443_HOST ?= $(patsubst %,%:443,$(NGINX_SERVICE_HOST))
|
||||
NGINX_SERVICE_443_PROTO ?= https tlsskipverify=true
|
||||
NGINX_SERVICE_443_TAGS ?= $(call tagprefix,nginx,443,host)
|
||||
NGINX_DEFAULT_HOST ?= $(firstword $(APP_HOST))
|
||||
NGINX_VIRTUAL_HOST ?= $(subst $(space),$(comma),$(APP_HOST))
|
||||
@@ -0,0 +1,55 @@
|
||||
version: '3.6'
|
||||
|
||||
services:
|
||||
nginx:
|
||||
build:
|
||||
args:
|
||||
- DOCKER_BUILD_DIR=docker/nginx
|
||||
context: ../..
|
||||
dockerfile: docker/nginx/Dockerfile
|
||||
environment:
|
||||
- DEFAULT_HOST=${NGINX_DEFAULT_HOST:-${NGINX_VIRTUAL_HOST:-localhost}}
|
||||
- LETSENCRYPT_HOST=${NGINX_LETSENCRYPT_HOST:-${NGINX_VIRTUAL_HOST:-}}
|
||||
- LETSENCRYPT_EMAIL=${NGINX_LETSENCRYPT_EMAIL:-${MAIL:-nginx@localhost}}
|
||||
- VIRTUAL_HOST=${NGINX_VIRTUAL_HOST:-localhost}
|
||||
image: ${DOCKER_REPOSITORY:-nginx}/nginx:${DOCKER_IMAGE_TAG:-latest}
|
||||
labels:
|
||||
- SERVICE_80_CHECK_TCP=${NGINX_SERVICE_80_CHECK_TCP:-true}
|
||||
- SERVICE_80_NAME=${COMPOSE_SERVICE_NAME:-docker}-nginx-80
|
||||
- SERVICE_80_TAGS=${NGINX_SERVICE_80_TAGS:-urlprefix-localhost:80/*}
|
||||
- SERVICE_443_CHECK_TCP=${NGINX_SERVICE_443_CHECK_TCP:-true}
|
||||
- SERVICE_443_NAME=${COMPOSE_SERVICE_NAME:-docker}-nginx-443
|
||||
- SERVICE_443_TAGS=${NGINX_SERVICE_443_TAGS:-urlprefix-localhost:443/* proto=https tlsskipverify=true}
|
||||
networks:
|
||||
- private
|
||||
- public
|
||||
ports:
|
||||
- 80
|
||||
- 443
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||
- certs:/etc/nginx/certs
|
||||
- html:/usr/share/nginx/html
|
||||
- log:/var/log/nginx
|
||||
- vhost:/etc/nginx/vhost.d
|
||||
|
||||
volumes:
|
||||
certs:
|
||||
html:
|
||||
log:
|
||||
vhost:
|
||||
www:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: none
|
||||
device: ${MONOREPO_DIR}
|
||||
o: bind
|
||||
|
||||
networks:
|
||||
private:
|
||||
external: true
|
||||
name: ${DOCKER_NETWORK_PRIVATE:-docker}
|
||||
public:
|
||||
external: true
|
||||
name: ${DOCKER_NETWORK_PUBLIC:-localhost}
|
||||
@@ -1,4 +1,3 @@
|
||||
ENV_VARS += STATIC_SERVICE_80_TAGS
|
||||
STATIC_SERVICE_URIS ?= $(patsubst %,static.%,$(APP_URIS))
|
||||
STATIC_SERVICE_80_TAGS ?= $(call urlprefix,,$(STATIC_SERVICE_80_URIS))
|
||||
STATIC_SERVICE_80_URIS ?= $(STATIC_SERVICE_URIS)
|
||||
STATIC_SERVICE_80_NAME ?= static
|
||||
STATIC_SERVICE_80_TAGS ?= $(call tagprefix,STATIC,80)
|
||||
|
||||
@@ -6,8 +6,8 @@ services:
|
||||
command: /bin/sh -c "grep autoindex /etc/nginx/conf.d/default.conf >/dev/null 2>&1 || sed -i 's|index index.html index.htm;|index index.html index.htm;\n autoindex on;|' /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
|
||||
labels:
|
||||
- SERVICE_80_CHECK_TCP=true
|
||||
- SERVICE_80_NAME=${COMPOSE_SERVICE_NAME}-nginx-80
|
||||
- SERVICE_80_TAGS=${STATIC_SERVICE_80_TAGS}
|
||||
- SERVICE_80_NAME=${COMPOSE_SERVICE_NAME:-docker}-static-80
|
||||
- SERVICE_80_TAGS=${STATIC_SERVICE_80_TAGS:-urlprefix-static.localhost/*}
|
||||
networks:
|
||||
- private
|
||||
- public
|
||||
@@ -23,7 +23,7 @@ volumes:
|
||||
networks:
|
||||
private:
|
||||
external: true
|
||||
name: ${DOCKER_NETWORK_PRIVATE}
|
||||
name: ${DOCKER_NETWORK_PRIVATE:-docker}
|
||||
public:
|
||||
external: true
|
||||
name: ${DOCKER_NETWORK_PUBLIC}
|
||||
name: ${DOCKER_NETWORK_PUBLIC:-static.localhost}
|
||||
|
||||
Reference in New Issue
Block a user