From cbcb25a25c149f09b0f0596c318e1d19931127d3 Mon Sep 17 00:00:00 2001 From: SharkoZ Date: Tue, 3 Sep 2019 08:57:13 +0200 Subject: [PATCH] Dockerise app --- Dockerfile | 12 ++++++++++++ nginx.tmpl | 26 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 Dockerfile create mode 100644 nginx.tmpl diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f03a4d7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM nginx:alpine +EXPOSE 80 +ENV LISTEN_PORT=80 \ + SERVER_URL=otrecorder \ + SERVER_PORT=80 + +COPY nginx.tmpl /etc/nginx/nginx.tmpl +COPY index.html /usr/share/nginx/html +COPY static/ /usr/share/nginx/html/static/ +RUN ls /usr/share/nginx/html/* +CMD /bin/sh -c "envsubst '\${SERVER_URL} \${SERVER_PORT} \${LISTEN_PORT}' < /etc/nginx/nginx.tmpl > /etc/nginx/nginx.conf && nginx -g 'daemon off;' || cat /etc/nginx/nginx.conf" + diff --git a/nginx.tmpl b/nginx.tmpl new file mode 100644 index 0000000..51f65ea --- /dev/null +++ b/nginx.tmpl @@ -0,0 +1,26 @@ +worker_processes 1; +events { + worker_connections 1024; +} +http { + upstream otrecorder { + server ${SERVER_URL}:${SERVER_PORT}; + } + server { + listen ${LISTEN_PORT}; + root /usr/share/nginx/html; + location /api { + proxy_pass http://otrecorder/api/; + } + location /ws { + proxy_pass http://otrecorder/ws/; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection upgrade; + } + location / { + try_files $uri $uri/index.html; + } + } +} +