2018-06-11 14:09:46 +00:00
|
|
|
FROM ruby:2.4.4-slim
|
2017-01-08 12:00:11 +00:00
|
|
|
MAINTAINER Zammad <info@zammad.org>
|
2016-12-17 11:10:51 +00:00
|
|
|
ARG BUILD_DATE
|
|
|
|
|
2017-11-26 20:25:57 +00:00
|
|
|
ENV ZAMMAD_DIR /opt/zammad
|
2017-07-22 13:14:20 +00:00
|
|
|
ENV ZAMMAD_USER zammad
|
2017-01-07 12:52:50 +00:00
|
|
|
ENV RAILS_ENV production
|
|
|
|
ENV RAILS_SERVER puma
|
2017-12-03 18:41:55 +00:00
|
|
|
ENV PROJECT_URL https://github.com/zammad/zammad
|
|
|
|
ENV GIT_URL ${PROJECT_URL}.git
|
2017-12-07 14:20:21 +00:00
|
|
|
ENV GIT_BRANCH stable
|
2017-12-03 18:41:55 +00:00
|
|
|
ENV ZAMMAD_TMP_DIR /tmp/zammad-${GIT_BRANCH}
|
|
|
|
ENV TAR_GZ_URL ${PROJECT_URL}/archive/${GIT_BRANCH}.tar.gz
|
2017-07-22 13:14:20 +00:00
|
|
|
ENV GOSU_VERSION 1.10
|
2017-12-07 14:20:21 +00:00
|
|
|
ENV ZAMMAD_READY_FILE ${ZAMMAD_DIR}/tmp/zammad.ready
|
2017-01-07 12:52:50 +00:00
|
|
|
|
2016-12-17 11:10:51 +00:00
|
|
|
LABEL org.label-schema.build-date="$BUILD_DATE" \
|
|
|
|
org.label-schema.name="Zammad" \
|
|
|
|
org.label-schema.license="AGPL-3.0" \
|
2017-01-12 13:14:25 +00:00
|
|
|
org.label-schema.description="Docker container for Zammad - Data Container" \
|
2016-12-17 11:10:51 +00:00
|
|
|
org.label-schema.url="https://zammad.org" \
|
|
|
|
org.label-schema.vcs-url="https://github.com/zammad/zammad" \
|
|
|
|
org.label-schema.vcs-type="Git" \
|
|
|
|
org.label-schema.vendor="Zammad" \
|
2017-01-10 00:56:18 +00:00
|
|
|
org.label-schema.schema-version="1.2" \
|
2017-01-06 14:11:05 +00:00
|
|
|
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
|
2016-12-17 11:10:51 +00:00
|
|
|
|
2017-12-03 18:41:55 +00:00
|
|
|
# install dependencies & gosu
|
2018-06-12 08:44:53 +00:00
|
|
|
RUN BUILD_DEPENDENCIES="build-essential ca-certificates curl dirmngr git gnupg2 libffi-dev libpq5 libpq-dev nginx rsync" \
|
2017-07-22 13:14:20 +00:00
|
|
|
set -ex \
|
2018-06-12 08:06:01 +00:00
|
|
|
&& apt-get update && apt-get install -y --no-install-recommends ${BUILD_DEPENDENCIES} && rm -rf /var/lib/apt/lists/* \
|
2017-12-03 18:41:55 +00:00
|
|
|
&& curl -s -J -L -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(dpkg --print-architecture)" \
|
|
|
|
&& curl -s -J -L -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(dpkg --print-architecture).asc" \
|
2017-07-22 13:14:20 +00:00
|
|
|
&& export GNUPGHOME="$(mktemp -d)" \
|
|
|
|
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
|
|
|
|
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
|
2018-04-14 14:25:54 +00:00
|
|
|
&& rm -rf "${GNUPGHOME}" /usr/local/bin/gosu.asc \
|
2017-07-22 13:14:20 +00:00
|
|
|
&& chmod +x /usr/local/bin/gosu \
|
2017-12-03 18:41:55 +00:00
|
|
|
&& gosu nobody true
|
|
|
|
|
|
|
|
# install zammad
|
|
|
|
RUN groupadd -g 1000 ${ZAMMAD_USER} \
|
|
|
|
&& useradd -M -d ${ZAMMAD_DIR} -s /bin/bash -u 1000 -g 1000 ${ZAMMAD_USER} \
|
2017-09-13 19:52:27 +00:00
|
|
|
&& cd $(dirname ${ZAMMAD_TMP_DIR}) \
|
2017-12-03 18:41:55 +00:00
|
|
|
&& curl -s -J -L -O "${TAR_GZ_URL}" \
|
|
|
|
&& tar -xzf zammad-${GIT_BRANCH}.tar.gz \
|
|
|
|
&& rm zammad-${GIT_BRANCH}.tar.gz \
|
2017-09-13 19:52:27 +00:00
|
|
|
&& cd ${ZAMMAD_TMP_DIR} \
|
2017-07-22 13:14:20 +00:00
|
|
|
&& 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 \
|
2018-04-14 14:23:15 +00:00
|
|
|
&& sed -i '/# Use a different logger for distributed setups./a \ \ config.logger = Logger.new(STDOUT)' config/environments/production.rb \
|
|
|
|
&& sed -i 's/.*scheduler_\(err\|out\).log.*//g' script/scheduler.rb \
|
2017-07-22 13:14:20 +00:00
|
|
|
&& bundle exec rake assets:precompile \
|
|
|
|
&& rm -r tmp/cache \
|
2017-09-13 19:52:27 +00:00
|
|
|
&& chown -R ${ZAMMAD_USER}:${ZAMMAD_USER} ${ZAMMAD_TMP_DIR}
|
2017-07-21 12:21:32 +00:00
|
|
|
|
2017-10-02 21:41:16 +00:00
|
|
|
# docker init
|
|
|
|
COPY containers/zammad/docker-entrypoint.sh /
|
2017-11-20 22:59:01 +00:00
|
|
|
RUN chmod +x /docker-entrypoint.sh
|
2017-10-02 21:41:16 +00:00
|
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
|
|
|
2017-07-22 16:34:20 +00:00
|
|
|
WORKDIR ${ZAMMAD_DIR}
|