This commit is contained in:
Alexey Golubev 2019-11-27 12:23:13 +03:00
commit 8e1a52566f
3 changed files with 52 additions and 27 deletions

@ -3,6 +3,8 @@ LABEL maintainer Ascensio System SIA <support@onlyoffice.com>
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive
ARG ONLYOFFICE_VALUE=onlyoffice
RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
apt-get -y update && \
apt-get -yq install wget apt-transport-https curl locales && \
@ -42,9 +44,9 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
supervisor \
xvfb \
zlib1g && \
sudo -u postgres psql -c "CREATE DATABASE onlyoffice;" && \
sudo -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';" && \
sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;" && \
sudo -u postgres psql -c "CREATE DATABASE $ONLYOFFICE_VALUE;" && \
sudo -u postgres psql -c "CREATE USER $ONLYOFFICE_VALUE WITH password '$ONLYOFFICE_VALUE';" && \
sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE $ONLYOFFICE_VALUE TO $ONLYOFFICE_VALUE;" && \
service postgresql stop && \
service redis-server stop && \
service rabbitmq-server stop && \
@ -52,24 +54,27 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
service nginx stop && \
rm -rf /var/lib/apt/lists/*
COPY config /app/onlyoffice/setup/config/
COPY run-document-server.sh /app/onlyoffice/run-document-server.sh
COPY config /app/ds/setup/config/
COPY run-document-server.sh /app/ds/run-document-server.sh
EXPOSE 80 443
ARG REPO_URL="deb http://download.onlyoffice.com/repo/debian squeeze main"
ARG PRODUCT_NAME=onlyoffice-documentserver
ARG COMPANY_NAME=onlyoffice
ARG PRODUCT_NAME=documentserver
RUN echo "$REPO_URL" | tee /etc/apt/sources.list.d/onlyoffice.list && \
ENV COMPANY_NAME=$COMPANY_NAME
RUN echo "$REPO_URL" | tee /etc/apt/sources.list.d/ds.list && \
apt-get -y update && \
service postgresql start && \
apt-get -yq install $PRODUCT_NAME && \
apt-get -yq install $COMPANY_NAME-$PRODUCT_NAME && \
service postgresql stop && \
service supervisor stop && \
chmod 755 /app/onlyoffice/*.sh && \
rm -rf /var/log/onlyoffice && \
chmod 755 /app/ds/*.sh && \
rm -rf /var/log/$COMPANY_NAME && \
rm -rf /var/lib/apt/lists/*
VOLUME /var/log/onlyoffice /var/lib/onlyoffice /var/www/onlyoffice/Data /var/lib/postgresql /usr/share/fonts/truetype/custom
VOLUME /var/log/$COMPANY_NAME /var/lib/$COMPANY_NAME /var/www/$COMPANY_NAME/Data /var/lib/postgresql /usr/share/fonts/truetype/custom
ENTRYPOINT /app/onlyoffice/run-document-server.sh
ENTRYPOINT /app/ds/run-document-server.sh

@ -1,8 +1,9 @@
COMPANY_NAME ?= onlyoffice
GIT_BRANCH ?= origin/develop
GIT_BRANCH ?= develop
PRODUCT_NAME ?= documentserver-ie
PRODUCT_VERSION ?= 0.0.0
BUILD_NUMBER ?= 0
ONLYOFFICE_VALUE ?= onlyoffice
PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER)
@ -11,36 +12,55 @@ REPO_URL := "deb [trusted=yes] http://repo-doc-onlyoffice-com.s3.amazonaws.com/u
UPDATE_LATEST := false
ifneq (,$(findstring develop,$(GIT_BRANCH)))
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))
DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))
DOCKER_TAGS += latest
else ifneq (,$(findstring release,$(GIT_BRANCH)))
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))
DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))
else ifneq (,$(findstring hotfix,$(GIT_BRANCH)))
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))
DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))
else
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH))
DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH))
endif
DOCKER_TAGS += $(DOCKER_TAG)
DOCKER_REPO = $(COMPANY_NAME)/4testing-$(PRODUCT_NAME)
COLON := __colon__
DOCKER_TARGETS := $(foreach TAG,$(DOCKER_TAGS),$(DOCKER_REPO)$(COLON)$(TAG))
.PHONY: all clean clean-docker deploy docker
DOCKER_ARCH := $(COMPANY_NAME)-$(PRODUCT_NAME)_$(PACKAGE_VERSION).tar.gz
.PHONY: all clean clean-docker deploy docker publish
$(DOCKER_TARGETS): $(DEB_REPO_DATA)
docker build --build-arg REPO_URL=$(REPO_URL) --build-arg PRODUCT_NAME=$(COMPANY_NAME)-$(PRODUCT_NAME) -t $(subst $(COLON),:,$@) . &&\
docker build \
--build-arg REPO_URL=$(REPO_URL) \
--build-arg COMPANY_NAME=$(COMPANY_NAME) \
--build-arg PRODUCT_NAME=$(PRODUCT_NAME) \
--build-arg ONLYOFFICE_VALUE=$(ONLYOFFICE_VALUE) \
-t $(subst $(COLON),:,$@) . &&\
mkdir -p $$(dirname $@) &&\
echo "Done" > $@
$(DOCKER_ARCH): $(DOCKER_TARGETS)
docker save $(DOCKER_REPO):$(DOCKER_TAG) | \
gzip > $@
all: $(DOCKER_TARGETS)
clean:
rm -rfv $(DOCKER_TARGETS)
rm -rfv $(DOCKER_TARGETS) $(DOCKER_ARCH)
clean-docker:
docker rmi -f $$(docker images -q $(COMPANY_NAME)/*) || exit 0
deploy: $(DOCKER_TARGETS)
$(foreach TARGET,$(DOCKER_TARGETS),docker push $(subst $(COLON),:,$(TARGET));)
publish: $(DOCKER_ARCH)
aws s3 cp \
$(DOCKER_ARCH) \
s3://repo-doc-onlyoffice-com.s3.amazonaws.com/docker/amd64/ \
--acl public-read

@ -3,13 +3,13 @@
# Define '**' behavior explicitly
shopt -s globstar
APP_DIR="/var/www/onlyoffice/documentserver"
DATA_DIR="/var/www/onlyoffice/Data"
LOG_DIR="/var/log/onlyoffice"
APP_DIR="/var/www/${COMPANY_NAME}/documentserver"
DATA_DIR="/var/www/${COMPANY_NAME}/Data"
LOG_DIR="/var/log/${COMPANY_NAME}"
DS_LOG_DIR="${LOG_DIR}/documentserver"
LIB_DIR="/var/lib/onlyoffice"
LIB_DIR="/var/lib/${COMPANY_NAME}"
DS_LIB_DIR="${LIB_DIR}/documentserver"
CONF_DIR="/etc/onlyoffice/documentserver"
CONF_DIR="/etc/${COMPANY_NAME}/documentserver"
ONLYOFFICE_DATA_CONTAINER=${ONLYOFFICE_DATA_CONTAINER:-false}
ONLYOFFICE_DATA_CONTAINER_HOST=${ONLYOFFICE_DATA_CONTAINER_HOST:-localhost}
@ -23,7 +23,7 @@ SSL_DHPARAM_PATH=${SSL_DHPARAM_PATH:-${SSL_CERTIFICATES_DIR}/dhparam.pem}
SSL_VERIFY_CLIENT=${SSL_VERIFY_CLIENT:-off}
ONLYOFFICE_HTTPS_HSTS_ENABLED=${ONLYOFFICE_HTTPS_HSTS_ENABLED:-true}
ONLYOFFICE_HTTPS_HSTS_MAXAGE=${ONLYOFFICE_HTTPS_HSTS_MAXAGE:-31536000}
SYSCONF_TEMPLATES_DIR="/app/onlyoffice/setup/config"
SYSCONF_TEMPLATES_DIR="/app/ds/setup/config"
NGINX_CONFD_PATH="/etc/nginx/conf.d";
NGINX_ONLYOFFICE_PATH="${CONF_DIR}/nginx"
@ -412,4 +412,4 @@ service nginx start
documentserver-generate-allfonts.sh ${ONLYOFFICE_DATA_CONTAINER}
documentserver-static-gzip.sh ${ONLYOFFICE_DATA_CONTAINER}
tail -f /var/log/onlyoffice/**/*.log
tail -f /var/log/${COMPANY_NAME}/**/*.log