From d4eefe47f48a47696841f0fdfa5909e99c8c97a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Sat, 7 Jan 2017 13:52:50 +0100 Subject: [PATCH] moved asstes precompile into image & bash variables into dockerfile env --- Dockerfile.zammad | 9 +++++++++ README.md | 4 ++++ docker-entrypoint.sh | 10 +--------- install-zammad.sh | 10 +++------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Dockerfile.zammad b/Dockerfile.zammad index 1c1cd56..463042c 100644 --- a/Dockerfile.zammad +++ b/Dockerfile.zammad @@ -2,6 +2,15 @@ FROM ruby:2.3.1 MAINTAINER André Bauer ARG BUILD_DATE +ENV ZAMMAD_DIR /home/zammad +ENV ZAMMAD_DEBUG no +ENV RAILS_ENV production +ENV RAILS_SERVER puma +ENV GIT_URL https://github.com/zammad/zammad.git +ENV GIT_BRANCH develop +#ENV GIT_URL https://github.com/monotek/zammad.git +#ENV GIT_BRANCH nulldb + LABEL org.label-schema.build-date="$BUILD_DATE" \ org.label-schema.name="Zammad" \ org.label-schema.license="AGPL-3.0" \ diff --git a/README.md b/README.md index d6c9386..8e82493 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,7 @@ This repo is meant to be the starting point for somebody who likes to use docker ### Building locally * docker-compose -f docker-compose-build.yml up + +### DockerHub Repo + +* https://hub.docker.com/r/monotek/zammad-docker-compose/ diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 2ceb24a..99d09ef 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,14 +1,7 @@ #!/bin/bash -ZAMMAD_DIR="/home/zammad" -RAILS_SERVER="puma" -RAILS_ENV="production" -DEBUG="no" - if [ "$1" = 'zammad' ]; then - export RAILS_ENV=${RAILS_ENV} - cd ${ZAMMAD_DIR} rake db:migrate &> /dev/null @@ -17,7 +10,6 @@ if [ "$1" = 'zammad' ]; then rake db:create rake db:migrate rake db:seed - rake assets:precompile rails r "Setting.set('es_url', 'http://elasticsearch:9200')" rake searchindex:rebuild fi @@ -38,7 +30,7 @@ if [ "$1" = 'zammad' ]; then bundle exec unicorn -p 3000 -c config/unicorn.rb -E ${RAILS_ENV} fi - if [ "${DEBUG}" == "yes" ]; then + if [ "${ZAMMAD_DEBUG}" == "yes" ]; then # keepalive if error while true; do echo "debugging..." diff --git a/install-zammad.sh b/install-zammad.sh index 5692dc8..bc8de1a 100644 --- a/install-zammad.sh +++ b/install-zammad.sh @@ -1,11 +1,5 @@ #!/bin/bash -ZAMMAD_DIR="/home/zammad" -GIT_URL="https://github.com/zammad/zammad.git" -GIT_BRANCH="develop" -#GIT_URL="https://github.com/monotek/zammad.git" -#GIT_BRANCH="unicorn" - # install zammad echo "installing zammad..." cd /tmp @@ -15,5 +9,7 @@ cp -R /tmp/zammad/.[!.]* ${ZAMMAD_DIR} cd ${ZAMMAD_DIR} rm -rf /tmp/zammad bundle install --without test development mysql -sed -e 's#.*username:.*# username: postgres#g' -e 's#.*password:.*# password: \n host: postgresql\n#g' < config/database.yml.pkgr > config/database.yml +sed -e 's#.*adapter: postgresql# adapter: nulldb#g' -e 's#.*username:.*# username: postgres#g' -e 's#.*password:.*# password: \n host: postgresql\n#g' < config/database.yml.pkgr > config/database.yml +bundle exec rake assets:precompile +sed -e 's#.*adapter: postgresql# adapter: postgresql#g' -e 's#.*username:.*# username: postgres#g' -e 's#.*password:.*# password: \n host: postgresql\n#g' < config/database.yml.pkgr > config/database.yml chown -R zammad:zammad /home/zammad/