forked from redsolution/xabber-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Dockerfile, compose, configs(ref redsolution#32)
- Loading branch information
1 parent
9735856
commit 0faf943
Showing
4 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get -y update && \ | ||
buildDeps="ca-certificates \ | ||
apt-utils \ | ||
curl \ | ||
gcc \ | ||
make \ | ||
expat \ | ||
libexpat1-dev \ | ||
git \ | ||
erlang" && \ | ||
apt-get install -y --no-install-recommends ${buildDeps} && \ | ||
apt-get autoremove -y && \ | ||
apt-get clean -y | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
|
||
RUN mkdir ./xabber-websocket && \ | ||
cd xabber-websocket && \ | ||
curl -sL https://github.com/redsolution/xabber-websocket/archive/0.3.1.tar.gz | \ | ||
tar -zx --strip-components=1 && \ | ||
make | ||
|
||
FROM ubuntu:20.04 | ||
|
||
RUN apt-get -y update && \ | ||
buildDeps="curl \ | ||
nginx" && \ | ||
apt-get install -y --no-install-recommends ${buildDeps} && \ | ||
apt-get autoremove -y && \ | ||
apt-get clean -y | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
|
||
COPY --from=0 /app/xabber-websocket/_rel/xabber_ws/ ./xabber_ws/ | ||
RUN rm -rf /etc/nginx/sites-enabled/default | ||
COPY ./docker/xabber.conf /etc/nginx/conf.d/ | ||
|
||
COPY . ./ | ||
|
||
COPY ./docker/entrypoint.sh /usr/local/bin/ | ||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ] | ||
|
||
CMD [ "/usr/sbin/nginx", "-g", "daemon off;" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
version: '3.4' | ||
services: | ||
xabber: | ||
build: ./ | ||
ports: | ||
- 3080:80 | ||
- 3081:8080 # HOST:CONTAINER | ||
restart: always | ||
environment: | ||
CONNECTION_URL: "'ws://localhost:3081/websocket'" | ||
LOG_LEVEL: "'WARN'" | ||
|
||
# ALL VALUES SHOULD BE QUOTED, STRINGS DOUBLE QUOTED | ||
# because first quotes will be dropped at run time in ENTRYPOINT | ||
|
||
# DEBUG | ||
# XABBER_ACCOUNT_URL | ||
# API_SERVICE_URL | ||
# USE_SOCIAL_AUTH | ||
# DEFAULT_LOGIN_SCREEN | ||
# STORAGE_NAME_ENDING | ||
# TURN_SERVERS_LIST | ||
# DISABLE_LOOKUP_WS | ||
# REGISTER_XMPP_ACCOUNT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
echo 'Start Xabber WS Server...' | ||
/app/xabber_ws/bin/xabber_ws start | ||
echo 'Start Xabber WS Server - OK' | ||
|
||
cd /app | ||
cp ./example_index.html ./index.html | ||
|
||
VARS=( | ||
CONNECTION_URL | ||
LOG_LEVEL | ||
DEBUG | ||
XABBER_ACCOUNT_URL | ||
API_SERVICE_URL | ||
USE_SOCIAL_AUTH | ||
DEFAULT_LOGIN_SCREEN | ||
STORAGE_NAME_ENDING | ||
TURN_SERVERS_LIST | ||
DISABLE_LOOKUP_WS | ||
REGISTER_XMPP_ACCOUNT | ||
) | ||
for var in ${VARS[@]} | ||
do | ||
echo "Check $var in index.html" | ||
if [ -z ${!var+x} ]; then | ||
echo "$var is empty" | ||
else | ||
grep -q "$var" ./index.html | ||
if [[ $? -eq 0 ]]; then | ||
echo "Replace $var in index.html" | ||
sed "s#$var.*#$var: ${!var},#" ./index.html > ./new_index.html && mv ./new_index.html ./index.html | ||
else | ||
echo "Add value var to index.html" | ||
sed "s/xabber.configure({/a $var: ${!var}," ./index.html > ./new_index.html && mv ./new_index.html ./index.html | ||
fi | ||
fi | ||
done | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
server { | ||
listen 80 default_server; | ||
server_name _; | ||
|
||
root /app; | ||
index index.html; | ||
|
||
location / { | ||
try_files $uri $uri/ =404; | ||
} | ||
} |