moved zammad user creation to install script, clone directly to /home without using /tmp

This commit is contained in:
André Bauer 2017-01-10 11:46:26 +01:00
parent 82092f3fba
commit 1403d48b8c
2 changed files with 20 additions and 8 deletions

View File

@ -23,9 +23,6 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \
EXPOSE 3000 EXPOSE 3000
EXPOSE 6042 EXPOSE 6042
# add zammad user
RUN useradd -m -d /home/zammad -s /bin/bash zammad;chown -R zammad:zammad /home/zammad
# install zammad # install zammad
COPY install-zammad.sh /tmp COPY install-zammad.sh /tmp
RUN chmod +x /tmp/install-zammad.sh;/bin/bash -l -c /tmp/install-zammad.sh RUN chmod +x /tmp/install-zammad.sh;/bin/bash -l -c /tmp/install-zammad.sh

View File

@ -2,18 +2,33 @@
set -e set -e
# install zammad
echo "installing zammad..." echo "installing zammad..."
cd /tmp
# crreate zammad user
useradd -M -d /home/zammad -s /bin/bash zammad
# # git clone zammad
cd /home
git clone --depth 1 -b "${GIT_BRANCH}" "${GIT_URL}" git clone --depth 1 -b "${GIT_BRANCH}" "${GIT_URL}"
cp -R /tmp/zammad/* "${ZAMMAD_DIR}"
cp -R /tmp/zammad/.[!.]* "${ZAMMAD_DIR}" # install zammad
cd "${ZAMMAD_DIR}" cd "${ZAMMAD_DIR}"
rm -rf /tmp/zammad
bundle install --without test development mysql bundle install --without test development mysql
# fetch locales
contrib/packager.io/fetch_locales.rb contrib/packager.io/fetch_locales.rb
# set nulldb database adapter for assets precompile
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 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
# assets precompile
bundle exec rake assets:precompile bundle exec rake assets:precompile
# set postgresql database adapter
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 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
# delete assets precompile cache
rm -r tmp/cache rm -r tmp/cache
# set user & group to zammad
chown -R zammad:zammad "${ZAMMAD_DIR}" chown -R zammad:zammad "${ZAMMAD_DIR}"