Skip to content

Commit

Permalink
Add docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
OscarSotoSanchez committed Mar 24, 2020
1 parent 4ecf7d0 commit 49e10b2
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Docker/Dockerfile
@@ -0,0 +1,27 @@
FROM nginx

RUN apt-get update \
&& apt-get install -y curl wget

# Install openvidu-call
RUN mkdir -p /var/www/openvidu-call
RUN wget -L -O /var/www/openvidu-call/openvidu-call.tar.gz \
"https://github.com/OpenVidu/openvidu-call/releases/download/v2.12.0/openvidu-call-2.12.0.tar.gz"
RUN tar zxf /var/www/openvidu-call/openvidu-call.tar.gz -C /var/www/openvidu-call
RUN chown -R www-data:www-data /var/www/openvidu-call

# Nginx conf
COPY ./openvidu-call.conf /etc/nginx/conf.d/default.conf

# Entrypoint
COPY ./entrypoint.sh /usr/local/bin
RUN chmod +x /usr/local/bin/entrypoint.sh

# Cleaning the house
RUN rm /var/www/openvidu-call/openvidu-call.tar.gz
RUN apt-get clean && \
apt-get autoclean && \
rm -Rf /tmp/* && \
rm -Rf /var/lib/apt/lists/*

CMD /usr/local/bin/entrypoint.sh
33 changes: 33 additions & 0 deletions Docker/entrypoint.sh
@@ -0,0 +1,33 @@
#!/bin/bash

[[ -z "${OPENVIDU_URL}" ]] && export OPENVIDU_URL=$(curl -s ifconfig.co)
[[ -z "${OPENVIDU_SECRET}" ]] && export OPENVIDU_SECRET=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)

echo "OPENVIDU URL: ${OPENVIDU_URL}"
echo "OPENVIDU SECRET: ${OPENVIDU_SECRET}"

# openvidu-call configuration
cat>/var/www/openvidu-call/ov-settings.json<<EOF
{
"openviduSettings": {
"chat": true,
"autopublish": false,
"toolbarButtons": {
"audio": true,
"video": true,
"screenShare": true,
"fullscreen": true,
"exit": true
}
},
"openviduCredentials": {
"openvidu_url": "${OPENVIDU_URL}",
"openvidu_secret": "${OPENVIDU_SECRET}"
}
}
EOF

chown www-data:www-data /var/www/openvidu-call/ov-settings.json
service nginx restart

tail -f /var/log/nginx/*.log
6 changes: 6 additions & 0 deletions Docker/openvidu-call.conf
@@ -0,0 +1,6 @@
server {
listen 80;
server_name localhost;

root /var/www/openvidu-call;
}

0 comments on commit 49e10b2

Please sign in to comment.