Add KanBoard OS user, update volume, go easier on cleanup

This commit is contained in:
Disassembler 2018-01-24 15:42:57 +01:00
parent 3e341b88bd
commit 136a207a2f
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
4 changed files with 13 additions and 12 deletions

View File

@ -11,16 +11,16 @@ docker build -t kanboard ${SOURCE_DIR}
# Populate database # Populate database
export KANBOARD_PWD=$(head -c 18 /dev/urandom | base64) export KANBOARD_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
docker run --rm -h kanboard kanboard cat /srv/kanboard/app/Schema/Sql/postgres.sql | docker exec -i -e PGPASSWORD=${KANBOARD_PWD} postgres psql kanboard kanboard docker run --rm kanboard cat /srv/kanboard/app/Schema/Sql/postgres.sql | docker exec -i -e PGPASSWORD=${KANBOARD_PWD} postgres psql kanboard kanboard
# Configure Kanboard # Configure Kanboard
mkdir -p /srv/kanboard/conf /srv/kanboard/data mkdir -p /srv/kanboard/conf /srv/kanboard/data/
chown -R 8009:8009 /srv/kanboard/data
envsubst <${SOURCE_DIR}/srv/kanboard/conf/config.php >/srv/kanboard/conf/config.php envsubst <${SOURCE_DIR}/srv/kanboard/conf/config.php >/srv/kanboard/conf/config.php
export KANBOARD_ADMIN_USER=admin export KANBOARD_ADMIN_USER=admin
export KANBOARD_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export KANBOARD_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export KANBOARD_ADMIN_HASH=$(docker run --rm -h kanboard kanboard php -r "echo password_hash('${KANBOARD_ADMIN_PWD}', PASSWORD_BCRYPT);") export KANBOARD_ADMIN_HASH=$(docker run --rm kanboard php -r "echo password_hash('${KANBOARD_ADMIN_PWD}', PASSWORD_BCRYPT);")
envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql kanboard envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql kanboard
chown 8009:8009 /srv/kanboard/data
# Create KanBoard service # Create KanBoard service
cp ${SOURCE_DIR}/etc/init.d/kanboard /etc/init.d/kanboard cp ${SOURCE_DIR}/etc/init.d/kanboard /etc/init.d/kanboard

View File

@ -16,7 +16,6 @@ RUN \
&& wget https://github.com/kanboard/kanboard/archive/v1.2.0.zip -O /srv/kanboard.zip \ && wget https://github.com/kanboard/kanboard/archive/v1.2.0.zip -O /srv/kanboard.zip \
&& unzip /srv/kanboard.zip -d /srv \ && unzip /srv/kanboard.zip -d /srv \
&& mv /srv/kanboard-1.2.0 /srv/kanboard \ && mv /srv/kanboard-1.2.0 /srv/kanboard \
&& rm -f /srv/kanboard.zip \
# Install plugins # Install plugins
&& git clone --depth=1 https://github.com/BlueTeck/kanboard_plugin_overwrite_translation /srv/kanboard/plugins/Overwrite_translation \ && git clone --depth=1 https://github.com/BlueTeck/kanboard_plugin_overwrite_translation /srv/kanboard/plugins/Overwrite_translation \
&& git clone --depth=1 https://github.com/BlueTeck/kanboard_plugin_coverimage /srv/kanboard/plugins/Coverimage \ && git clone --depth=1 https://github.com/BlueTeck/kanboard_plugin_coverimage /srv/kanboard/plugins/Coverimage \
@ -32,15 +31,17 @@ RUN \
&& git clone --depth=1 https://github.com/kanboard/plugin-task-board-date /srv/kanboard/plugins/TaskBoardDate \ && git clone --depth=1 https://github.com/kanboard/plugin-task-board-date /srv/kanboard/plugins/TaskBoardDate \
&& git clone --depth=1 https://github.com/oliviermaridat/kanboard-milestone-plugin /srv/kanboard/plugins/Milestone \ && git clone --depth=1 https://github.com/oliviermaridat/kanboard-milestone-plugin /srv/kanboard/plugins/Milestone \
&& git clone --depth=1 https://github.com/xavividal/kanboard-plugin-relationgraph /srv/kanboard/plugins/Relationgraph \ && git clone --depth=1 https://github.com/xavividal/kanboard-plugin-relationgraph /srv/kanboard/plugins/Relationgraph \
# Create OS user
&& addgroup -S -g 8009 kanboard \
&& adduser -S -u 8009 -h /srv/kanboard -s /bin/false -g kanboard -G kanboard kanboard \
# Cleanup # Cleanup
&& apk del .deps \ && apk del .deps \
&& find /srv/kanboard -name '.git*' -exec rm -rf {} + \ && rm -f /srv/kanboard.zip \
&& rm -rf /root \ && find /srv/kanboard -name '.git*' -exec rm -rf {} +
&& mkdir /root
COPY docker/ / COPY docker/ /
VOLUME ["/srv/kanboard/app/data"] VOLUME ["/srv/kanboard/data/files"]
EXPOSE 8009 EXPOSE 8009
CMD ["s6-svscan", "/etc/services.d"] CMD ["s6-svscan", "/etc/services.d"]

View File

@ -4,8 +4,8 @@ daemonize = no
[kanboard] [kanboard]
catch_workers_output = yes catch_workers_output = yes
user = nginx user = kanboard
group = nginx group = kanboard
listen.owner = nginx listen.owner = nginx
listen.group = nginx listen.group = nginx
listen = /var/run/kanboard.sock listen = /var/run/kanboard.sock

View File

@ -9,7 +9,7 @@ depend() {
} }
start() { start() {
/usr/bin/docker run -d --rm --name kanboard -h kanboard --link postgres -p 127.0.0.1:9009:8009 -v /srv/kanboard/data:/srv/kanboard/app/data -v /srv/kanboard/conf/config.php:/srv/kanboard/config.php kanboard /usr/bin/docker run -d --rm --name kanboard -h kanboard --link postgres -p 127.0.0.1:9009:8009 -v /srv/kanboard/data:/srv/kanboard/data/files -v /srv/kanboard/conf/config.php:/srv/kanboard/config.php kanboard
} }
stop() { stop() {