Add nginx Dockerfile
This commit is contained in:
parent
0176703f88
commit
bb38b8d9d7
@ -12,6 +12,20 @@ services:
|
||||
- mysql:/var/lib/mysql
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "--silent"]
|
||||
nginx:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: nginx.Dockerfile
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
HOSTNAME: 'changeme.example.com'
|
||||
HTTP_PORT: 8080
|
||||
YOTTER_ADDRESS: 'http://yotter:5000'
|
||||
YTPROXY_ADDRESS: 'http://unix:/var/run/ytproxy/http-proxy.sock'
|
||||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
volumes:
|
||||
- "/var/run/ytproxy:/app/socket/"
|
||||
ytproxy:
|
||||
image: 1337kavin/ytproxy:latest
|
||||
restart: unless-stopped
|
||||
|
12
nginx.Dockerfile
Normal file
12
nginx.Dockerfile
Normal file
@ -0,0 +1,12 @@
|
||||
FROM nginx:mainline-alpine
|
||||
|
||||
WORKDIR /var/www
|
||||
COPY ./app/static ./static
|
||||
COPY ./nginx.conf.tmpl /nginx.conf.tmpl
|
||||
|
||||
ENV HOSTNAME= \
|
||||
HTTP_PORT=80 \
|
||||
YOTTER_ADDRESS=http://127.0.0.1:5000 \
|
||||
YTPROXY_ADDRESS=http://unix:/var/run/ytproxy/http-proxy.sock
|
||||
|
||||
CMD ["/bin/sh", "-c", "envsubst '${HOSTNAME} ${HTTP_PORT} ${YOTTER_ADDRESS} ${YTPROXY_ADDRESS}' < /nginx.conf.tmpl > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"]
|
30
nginx.conf.tmpl
Normal file
30
nginx.conf.tmpl
Normal file
@ -0,0 +1,30 @@
|
||||
server {
|
||||
listen ${HTTP_PORT};
|
||||
server_name ${HOSTNAME};
|
||||
access_log off;
|
||||
|
||||
location / {
|
||||
proxy_pass ${YOTTER_ADDRESS};
|
||||
proxy_set_header Host $host;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
root /var/www;
|
||||
sendfile on;
|
||||
aio threads=default;
|
||||
}
|
||||
|
||||
location ~ (^/videoplayback$|/videoplayback/|/vi/|/a/|/ytc|/vi_webp/|/sb/) {
|
||||
proxy_pass ${YTPROXY_ADDRESS};
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
aio_write on;
|
||||
aio threads=default;
|
||||
directio 512;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user