diff --git a/docker/Dockerfile b/docker/Dockerfile index 4f92a24..624a709 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -18,4 +18,9 @@ RUN apk del ca-certificates wget RUN rm -rf /var/cache/apk/* +# copy files +COPY docker-entrypoint.sh / +COPY database.conf ./ + +ENTRYPOINT ["/docker-entrypoint.sh"] CMD java -jar $GITBUCKET_HOME/latest.war --host=$GITBUCKET_HOST --port=$GITBUCKET_PORT --gitbucket.home=$GITBUCKET_HOME diff --git a/docker/database.conf b/docker/database.conf new file mode 100644 index 0000000..ba6c630 --- /dev/null +++ b/docker/database.conf @@ -0,0 +1,5 @@ +db { + url = "jdbc:mysql://GITBUCKET_DATABASE_HOST/GITBUCKET_DATABASE_NAME?useUnicode=true&characterEncoding=utf8" + user = "GITBUCKET_DATABASE_USER" + password = "GITBUCKET_DATABASE_PASSWORD" +} diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh new file mode 100644 index 0000000..8a31fe6 --- /dev/null +++ b/docker/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# replace mysql settings in config file +dbfile=${GITBUCKET_HOME}/database.config +sed -i "/GITBUCKET_DATABASE_NAME/c\\${GITBUCKET_DATABASE_NAME};" $dbfile +sed -i "/GITBUCKET_DATABASE_HOST/c\\${GITBUCKET_DATABASE_HOST};" $dbfile +sed -i "/GITBUCKET_DATABASE_PASSWORD/c\\${GITBUCKET_DATABASE_PASSWORD};" $dbfile +sed -i "/GITBUCKET_DATABASE_USER/c\\${GITBUCKET_DATABASE_USER};" $dbfile + + +# start gitbucket