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

View file

@ -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 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 && \ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
apt-get -y update && \ apt-get -y update && \
apt-get -yq install wget apt-transport-https curl locales && \ 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 \ supervisor \
xvfb \ xvfb \
zlib1g && \ zlib1g && \
sudo -u postgres psql -c "CREATE DATABASE onlyoffice;" && \ sudo -u postgres psql -c "CREATE DATABASE $ONLYOFFICE_VALUE;" && \
sudo -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';" && \ sudo -u postgres psql -c "CREATE USER $ONLYOFFICE_VALUE WITH password '$ONLYOFFICE_VALUE';" && \
sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;" && \ sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE $ONLYOFFICE_VALUE TO $ONLYOFFICE_VALUE;" && \
service postgresql stop && \ service postgresql stop && \
service redis-server stop && \ service redis-server stop && \
service rabbitmq-server stop && \ service rabbitmq-server stop && \
@ -52,24 +54,27 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
service nginx stop && \ service nginx stop && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
COPY config /app/onlyoffice/setup/config/ COPY config /app/ds/setup/config/
COPY run-document-server.sh /app/onlyoffice/run-document-server.sh COPY run-document-server.sh /app/ds/run-document-server.sh
EXPOSE 80 443 EXPOSE 80 443
ARG REPO_URL="deb http://download.onlyoffice.com/repo/debian squeeze main" 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 && \ apt-get -y update && \
service postgresql start && \ service postgresql start && \
apt-get -yq install $PRODUCT_NAME && \ apt-get -yq install $COMPANY_NAME-$PRODUCT_NAME && \
service postgresql stop && \ service postgresql stop && \
service supervisor stop && \ service supervisor stop && \
chmod 755 /app/onlyoffice/*.sh && \ chmod 755 /app/ds/*.sh && \
rm -rf /var/log/onlyoffice && \ rm -rf /var/log/$COMPANY_NAME && \
rm -rf /var/lib/apt/lists/* 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

View file

@ -1,8 +1,9 @@
COMPANY_NAME ?= onlyoffice COMPANY_NAME ?= onlyoffice
GIT_BRANCH ?= origin/develop GIT_BRANCH ?= develop
PRODUCT_NAME ?= documentserver-ie PRODUCT_NAME ?= documentserver-ie
PRODUCT_VERSION ?= 0.0.0 PRODUCT_VERSION ?= 0.0.0
BUILD_NUMBER ?= 0 BUILD_NUMBER ?= 0
ONLYOFFICE_VALUE ?= onlyoffice
PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER) 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 UPDATE_LATEST := false
ifneq (,$(findstring develop,$(GIT_BRANCH))) ifneq (,$(findstring develop,$(GIT_BRANCH)))
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION)) DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))
DOCKER_TAGS += latest DOCKER_TAGS += latest
else ifneq (,$(findstring release,$(GIT_BRANCH))) else ifneq (,$(findstring release,$(GIT_BRANCH)))
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION)) DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))
else ifneq (,$(findstring hotfix,$(GIT_BRANCH))) else ifneq (,$(findstring hotfix,$(GIT_BRANCH)))
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION)) DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))
else else
DOCKER_TAGS += $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH)) DOCKER_TAG += $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH))
endif endif
DOCKER_TAGS += $(DOCKER_TAG)
DOCKER_REPO = $(COMPANY_NAME)/4testing-$(PRODUCT_NAME) DOCKER_REPO = $(COMPANY_NAME)/4testing-$(PRODUCT_NAME)
COLON := __colon__ COLON := __colon__
DOCKER_TARGETS := $(foreach TAG,$(DOCKER_TAGS),$(DOCKER_REPO)$(COLON)$(TAG)) 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_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 $@) &&\ mkdir -p $$(dirname $@) &&\
echo "Done" > $@ echo "Done" > $@
$(DOCKER_ARCH): $(DOCKER_TARGETS)
docker save $(DOCKER_REPO):$(DOCKER_TAG) | \
gzip > $@
all: $(DOCKER_TARGETS) all: $(DOCKER_TARGETS)
clean: clean:
rm -rfv $(DOCKER_TARGETS) rm -rfv $(DOCKER_TARGETS) $(DOCKER_ARCH)
clean-docker: clean-docker:
docker rmi -f $$(docker images -q $(COMPANY_NAME)/*) || exit 0 docker rmi -f $$(docker images -q $(COMPANY_NAME)/*) || exit 0
deploy: $(DOCKER_TARGETS) deploy: $(DOCKER_TARGETS)
$(foreach TARGET,$(DOCKER_TARGETS),docker push $(subst $(COLON),:,$(TARGET));) $(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

View file

@ -3,13 +3,13 @@
# Define '**' behavior explicitly # Define '**' behavior explicitly
shopt -s globstar shopt -s globstar
APP_DIR="/var/www/onlyoffice/documentserver" APP_DIR="/var/www/${COMPANY_NAME}/documentserver"
DATA_DIR="/var/www/onlyoffice/Data" DATA_DIR="/var/www/${COMPANY_NAME}/Data"
LOG_DIR="/var/log/onlyoffice" LOG_DIR="/var/log/${COMPANY_NAME}"
DS_LOG_DIR="${LOG_DIR}/documentserver" DS_LOG_DIR="${LOG_DIR}/documentserver"
LIB_DIR="/var/lib/onlyoffice" LIB_DIR="/var/lib/${COMPANY_NAME}"
DS_LIB_DIR="${LIB_DIR}/documentserver" 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=${ONLYOFFICE_DATA_CONTAINER:-false}
ONLYOFFICE_DATA_CONTAINER_HOST=${ONLYOFFICE_DATA_CONTAINER_HOST:-localhost} 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} SSL_VERIFY_CLIENT=${SSL_VERIFY_CLIENT:-off}
ONLYOFFICE_HTTPS_HSTS_ENABLED=${ONLYOFFICE_HTTPS_HSTS_ENABLED:-true} ONLYOFFICE_HTTPS_HSTS_ENABLED=${ONLYOFFICE_HTTPS_HSTS_ENABLED:-true}
ONLYOFFICE_HTTPS_HSTS_MAXAGE=${ONLYOFFICE_HTTPS_HSTS_MAXAGE:-31536000} 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_CONFD_PATH="/etc/nginx/conf.d";
NGINX_ONLYOFFICE_PATH="${CONF_DIR}/nginx" NGINX_ONLYOFFICE_PATH="${CONF_DIR}/nginx"
@ -412,4 +412,4 @@ service nginx start
documentserver-generate-allfonts.sh ${ONLYOFFICE_DATA_CONTAINER} documentserver-generate-allfonts.sh ${ONLYOFFICE_DATA_CONTAINER}
documentserver-static-gzip.sh ${ONLYOFFICE_DATA_CONTAINER} documentserver-static-gzip.sh ${ONLYOFFICE_DATA_CONTAINER}
tail -f /var/log/onlyoffice/**/*.log tail -f /var/log/${COMPANY_NAME}/**/*.log