Docker install (#7)

Add Dockerfile to support usage via Docker. Upload images on Dockerhub.
This commit is contained in:
Linus Groh
2019-09-24 12:51:42 +01:00
committed by GitHub
3 changed files with 63 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
FROM nginx:alpine
EXPOSE 80
ENV LISTEN_PORT=80 \
SERVER_HOST=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/
CMD /bin/sh -c "envsubst '\${SERVER_HOST} \${SERVER_PORT} \${LISTEN_PORT}' < /etc/nginx/nginx.tmpl > /etc/nginx/nginx.conf && nginx -g 'daemon off;' || ( env; cat /etc/nginx/nginx.conf )"
+25
View File
@@ -12,8 +12,33 @@ This is a web interface for [OwnTracks](https://github.com/owntracks/recorder),
## Installation
### Manual install
Clone the repository and copy `index.html` and the `static/` directory to your server's webroot. The API is expected to be reachable under the same domain as the web interface.
### Docker
You can launch directly via Docker run like this:
```console
$ docker run -d -p 80:80 -e SERVER_HOST=otrecorder-host -e SERVER_PORT=otrecorder-port cosme/owntracks-ui
```
Or you can use `docker-compose` (if you also run the OwnTracks Recorder with the default compose config, and the service is named `otrecorder`):
```yaml
version: '3'
services:
owntracks-ui:
image: cosme/owntracks-ui
ports:
- 80:80
environment:
- SERVER_HOST=otrecorder
- SERVER_PORT=8083
restart: unless-stopped
```
## Features
- Enable or disable multiple layers:
+27
View File
@@ -0,0 +1,27 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
upstream otrecorder {
server ${SERVER_HOST}:${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 / {
include /etc/nginx/mime.types;
try_files $uri $uri/index.html;
}
}
}