Made proxy container with templated config
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
openvpn:
|
||||
transmission:
|
||||
image: haugene/transmission-openvpn
|
||||
privileged: true
|
||||
ports:
|
||||
- "9091:9091"
|
||||
dns:
|
||||
- 8.8.8.8
|
||||
- 8.8.4.4
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /your/storage/path/:/data
|
||||
@@ -11,13 +12,13 @@ openvpn:
|
||||
OPENVPN_USERNAME: username
|
||||
OPENVPN_PASSWORD: password
|
||||
|
||||
|
||||
nginx:
|
||||
image: library/nginx
|
||||
proxy:
|
||||
image: haugene/transmission-openvpn-proxy
|
||||
links:
|
||||
- openvpn
|
||||
- transmission
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- 8080:8080
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /path/to/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
environment:
|
||||
PORT: 8080
|
||||
|
14
proxy/Dockerfile
Normal file
14
proxy/Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
||||
FROM nginx
|
||||
|
||||
# Get curl and dockerize
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y curl \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
||||
&& curl -L https://github.com/jwilder/dockerize/releases/download/v0.2.0/dockerize-linux-amd64-v0.2.0.tar.gz | tar -C /usr/local/bin -xzv
|
||||
|
||||
# Set default Transmission port and copy config template
|
||||
ENV TRANSMISSION_PORT=9091
|
||||
COPY nginx.tmpl /etc/nginx/nginx.tmpl
|
||||
|
||||
# Run nginx after dockerizing config
|
||||
CMD [ "dockerize", "-template", "/etc/nginx/nginx.tmpl:/etc/nginx/nginx.conf", "nginx", "-g", "daemon off;" ]
|
23
proxy/nginx.tmpl
Normal file
23
proxy/nginx.tmpl
Normal file
@@ -0,0 +1,23 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
server {
|
||||
listen {{ .Env.PORT }};
|
||||
|
||||
location / {
|
||||
proxy_pass http://transmission:{{ .Env.TRANSMISSION_PORT }};
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# HTTP 1.1 support
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user