-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·46 lines (37 loc) · 1.22 KB
/
entrypoint.sh
File metadata and controls
executable file
·46 lines (37 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# originally based on https://github.com/dinkel/docker-openldap
# When not limiting the open file descritors limit, the memory consumption of
# slapd is absurdly high. See https://github.com/docker/docker/issues/8231
ulimit -n 8192
set -e
WWW_DIR=/usr/share/nginx/html
CONFIG=1
# check for required vars
if [[ -z "$CONFIG_REPO" ]]; then
echo -n >&2 "Warning: no configuration repository is set "
echo >&2 "Did you forget to add -e CONFIG_REPO=... ?"
CONFIG=0
fi
if [[ -z "$CONFIG_USER" ]]; then
echo -n >&2 "Warning: the user or team name is not set "
echo >&2 "Did you forget to add -e CONFIG_USER=... ?"
CONFIG=0
fi
if [[ -z "$CONFIG_PASS" ]]; then
echo -n >&2 "Warning: the password or API key is not set "
echo >&2 "Did you forget to add -e CONFIG_PASS=... ?"
CONFIG=0
fi
if [[ CONFIG -eq 1 ]]; then
# reset content directory
rm -rf ${WWW_DIR}/*
# clone the git repo
echo "cloning config repository..."
rm -rf /root/httpd-config
git clone https://${CONFIG_USER}:${CONFIG_PASS}@${CONFIG_REPO} /root/httpd-config
# copy files to WWW_DIR
echo "copying files to ${WWW_DIR}"
cp -r /root/httpd-config/www/* ${WWW_DIR}/
fi
echo "starting the server"
exec "$@"