diff --git a/containers/zammad-railsserver/docker-entrypoint.sh b/containers/zammad-railsserver/docker-entrypoint.sh index e07ebcb..3979e2a 100644 --- a/containers/zammad-railsserver/docker-entrypoint.sh +++ b/containers/zammad-railsserver/docker-entrypoint.sh @@ -10,10 +10,11 @@ if [ "$1" = 'zammad-railsserver' ]; then echo "railsserver can access postgresql server now..." + rsync -a --delete ${ZAMMAD_TMP_DIR}/ ${ZAMMAD_DIR} + cd ${ZAMMAD_DIR} # update zammad - git pull gem update bundler bundle install @@ -33,9 +34,6 @@ if [ "$1" = 'zammad-railsserver' ]; then chown -R ${ZAMMAD_USER}:${ZAMMAD_USER} ${ZAMMAD_DIR} - # delete logs - find ${ZAMMAD_DIR}/log -iname *.log -exec rm {} \; - # run zammad echo "starting zammad..." echo "zammad will be accessable on http://localhost in some seconds" diff --git a/containers/zammad/Dockerfile b/containers/zammad/Dockerfile index 20baa8d..b99c53c 100644 --- a/containers/zammad/Dockerfile +++ b/containers/zammad/Dockerfile @@ -3,6 +3,7 @@ MAINTAINER Zammad ARG BUILD_DATE ENV ZAMMAD_DIR /home/zammad +ENV ZAMMAD_TMP_DIR /tmp/zammad ENV ZAMMAD_USER zammad ENV RAILS_ENV production ENV RAILS_SERVER puma @@ -22,7 +23,7 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \ org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up" # install dependencies, GOSU & zammad -RUN BUILD_DEPENDENCIES="git build-essential libffi-dev libpq5 libpq-dev" \ +RUN BUILD_DEPENDENCIES="git build-essential libffi-dev libpq5 libpq-dev rsync" \ GOSU_DEPENDENCIES="ca-certificates wget" \ set -ex \ && apt-get update && apt-get install -y --force-yes --no-install-recommends ${BUILD_DEPENDENCIES} ${GOSU_DEPENDENCIES} && rm -rf /var/lib/apt/lists/* \ @@ -35,15 +36,15 @@ RUN BUILD_DEPENDENCIES="git build-essential libffi-dev libpq5 libpq-dev" \ && chmod +x /usr/local/bin/gosu \ && gosu nobody true \ && useradd -M -d ${ZAMMAD_DIR} -s /bin/bash ${ZAMMAD_USER} \ - && cd $(dirname ${ZAMMAD_DIR}) \ + && cd $(dirname ${ZAMMAD_TMP_DIR}) \ && git clone --depth 1 -b "${GIT_BRANCH}" "${GIT_URL}" \ - && cd ${ZAMMAD_DIR} \ + && cd ${ZAMMAD_TMP_DIR} \ && bundle install --without test development mysql \ && contrib/packager.io/fetch_locales.rb \ && sed -e 's#.*adapter: postgresql# adapter: nulldb#g' -e 's#.*username:.*# username: postgres#g' -e 's#.*password:.*# password: \n host: zammad-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: zammad-postgresql\n#g' < config/database.yml.pkgr > config/database.yml \ && rm -r tmp/cache \ - && chown -R ${ZAMMAD_USER}:${ZAMMAD_USER} ${ZAMMAD_DIR} + && chown -R ${ZAMMAD_USER}:${ZAMMAD_USER} ${ZAMMAD_TMP_DIR} WORKDIR ${ZAMMAD_DIR}