docker: set volumes

This commit is contained in:
Zhang Cheng 2017-07-02 01:51:47 +08:00
parent d9c1911dcd
commit 8ad1cb7fac
3 changed files with 13 additions and 3 deletions

View File

@ -60,7 +60,8 @@ RUN apk add --no-cache mysql-client
COPY --from=builder /DWSurvey/target/diaowen.war /diaowen.war
COPY docker-entry.sh /docker-entry.sh
# TODO set volumes
# TODO this is a dirty hack
VOLUME ["/dwsurvey/WEB-INF/wjHtml", "/dwsurvey/WEB-INF/classes/conf/site"]
EXPOSE 8080

View File

@ -15,6 +15,9 @@ services:
dwsurvey:
image: dwsurvey
restart: always
volumes:
- "dwsurvey-wjHtml:/dwsurvey/WEB-INF/wjHtml"
- "dwsurvey-site:/dwsurvey/WEB-INF/classes/conf/site"
links:
- db
environment:
@ -30,3 +33,5 @@ services:
volumes:
mysql-data: {}
dwsurvey-wjHtml: {}
dwsurvey-site: {}

View File

@ -2,6 +2,7 @@
set -e
WAR_FILE=/diaowen.war
UNPACK_DIR=/dwsurvey
WEBAPP_BASE=$CATALINA_HOME/webapps
# determine context root path
@ -32,8 +33,11 @@ init_run() {
require_env MYSQL_PASSWORD
echo "Unpacking war ..."
mkdir -p "$WEBAPP_DIR"
unzip -q -x "$WAR_FILE" -d "$WEBAPP_DIR"
mkdir -p "$UNPACK_DIR"
unzip -q -x "$WAR_FILE" -d "$UNPACK_DIR" \
-x "WEB-INF/wjHtml/*" \
-x "WEB-INF/classes/conf/site/*"
ln -snf "$UNPACK_DIR" "$WEBAPP_DIR"
echo "Configuring dwsurvey ..."
sed -i "s^jdbc.url=.*\$jdbc.url=jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DATABASE}?useUnicode=true\&characterEncoding=utf8g;