#!/usr/bin/env bash set -e # install dependencies if [ "$1" = 'builder' ]; then PACKAGES="build-essential curl git libimlib2-dev libpq-dev shared-mime-info" elif [ "$1" = 'runner' ]; then PACKAGES="curl libimlib2 libpq5 nginx rsync" fi apt-get update apt-get upgrade -y # shellcheck disable=SC2086 apt-get install -y --no-install-recommends ${PACKAGES} if [ "$1" = 'builder' ]; then # Install Node.js 16 repository from Nodesource apt-get --no-install-recommends -y install gnupg KEYRING=/usr/share/keyrings/nodesource.gpg curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee "$KEYRING" >/dev/null cat - > /etc/apt/sources.list.d/nodesource.list < config/database.yml sed -i "/require 'rails\/all'/a require\ 'nulldb'" config/application.rb sed -i 's/.*scheduler_\(err\|out\).log.*//g' script/background-services.rb touch db/schema.rb bundle exec rake assets:precompile rm -r tmp/cache script/build/cleanup.sh chown -R "${ZAMMAD_USER}":"${ZAMMAD_USER}" "${ZAMMAD_TMP_DIR}" fi # set nginx file permissions and settings if [ "$1" = 'runner' ]; then sed -i -e "s#user www-data;##g" -e 's#/var/log/nginx/\(access\|error\).log#/dev/stdout#g' -e 's#pid /run/nginx.pid;#pid /tmp/nginx.pid;#g' /etc/nginx/nginx.conf mkdir -p "${ZAMMAD_DIR}" /var/log/nginx chown -R "${ZAMMAD_USER}":"${ZAMMAD_USER}" /etc/nginx "${ZAMMAD_DIR}" /var/lib/nginx /var/log/nginx fi