Add Dockerfile and nginx proxy configuration

master
informatic 2018-06-21 21:42:34 +02:00
parent b81b2b6fce
commit 1a80c9474c
5 changed files with 56 additions and 2 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
node_modules
dist
Dockerfile

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
# Frontend build environment
FROM node:10.5-alpine
RUN mkdir -p /usr/src/app
COPY package.json /usr/src/app
RUN cd /usr/src/app && npm install
COPY . /usr/src/app
RUN cd /usr/src/app && npm run build
# Final nginx container
FROM nginx:1.15
COPY nginx/default.conf /etc/nginx/conf.d
COPY --from=0 /usr/src/app/dist/ /usr/share/nginx/html/

29
nginx/default.conf Normal file
View File

@ -0,0 +1,29 @@
server {
listen 80;
server_name streaming;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location = /janus { proxy_pass http://janus:8088/janus; }
location /janus/ { proxy_pass http://janus:8088/janus/; }
location /janus-ws {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://janus:8188;
}
location /socket.io {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://api:5000/socket.io;
}
location /api {
proxy_pass http://api:5000/api;
}
}

View File

@ -4,7 +4,7 @@
<Scene v-bind:scene="currentScene" />
<a-spin :spinning="streamStatus != 'playing'">
<JanusStream :config="{ url: 'ws://10.8.0.95:8188' }" :stream="10" class="videoframe"
<JanusStream :config="janusConfig" :stream="10" class="videoframe"
@status="streamStatus = $event"
@bitrate="streamBitrate = $event" />
</a-spin>
@ -44,6 +44,12 @@ export default {
},
currentScene () {
return this.$store.state.scenes[this.$route.params.id]
},
janusConfig () {
var wsproto = (window.location.protocol === 'https:') ? 'wss' : 'ws'
return {
url: `${wsproto}://${window.location.host}/janus-ws`
}
}
}
}

View File

@ -32,7 +32,7 @@ export default new Vuex.Store({
},
actions: {
initialize ({ commit }) {
this.socket = io('http://' + API_HOST + ':5000')
this.socket = io()
this.socket.on('connect', () => {
console.log('Socket.IO connected:', this.socket.id)