-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
31 lines (24 loc) · 1.21 KB
/
docker-entrypoint.sh
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
#!/bin/sh
[ -e "${KITODO_HOME}/config/modules.xml" ] || \
(unzip -n -d "${KITODO_HOME}" /tmp/kitodo_config.zip && \
mv "${KITODO_HOME}/kitodo_${KITODO_VERSION_}_config_modules"/* "${KITODO_HOME}" && \
rmdir "${KITODO_HOME}/kitodo_${KITODO_VERSION_}_config_modules")
# Database configuration
/bin/sed -i \
"s,\(jdbc:mysql://\)[^/]*\(/.*\),\1${DB_ADDR}:${DB_PORT}\2," \
${CATALINA_HOME}/webapps/kitodo/WEB-INF/classes/hibernate.cfg.xml
# Elasticsearch configuration
/bin/sed -i \
"s,^\(elasticsearch.host\)=.*,\1=${ELASTIC_ADDR}," \
${CATALINA_HOME}/webapps/kitodo/WEB-INF/classes/kitodo_config.properties
# Wait for database container
/tmp/wait-for-it.sh -t 0 ${DB_ADDR}:${DB_PORT}
# Initialize database if necessary
echo "SELECT 1 FROM user LIMIT 1;" \
| mysql -h "${DB_ADDR}" -P "${DB_PORT}" -u kitodo --password=kitodo kitodo >/dev/null 2>&1 \
|| mysql -h "${DB_ADDR}" -P "${DB_PORT}" -u kitodo --password=kitodo kitodo < /tmp/kitodo.sql
git clone https://github.com/subugoe/Operandi-Integration-Script.git "${KITODO_HOME}/Operandi-Integration-Script"
chmod 777 -R "${KITODO_HOME}/Operandi-Integration-Script/"*
mv /Example_Workflow.* "${KITODO_HOME}/diagrams/"
# Run CMD
"$@"