Add build Documentserver without example (#473)

* Add dockerfile for non-example build

* Create new symlink for supervisor config

* Add ARG for dynamic images specification

* Update action version

* Add build nonexample after stable build success

* Add targets for nonexample build

* Cosmetic changes

* Update FROM instruction

* Add default tag

* Remove needless welcome nginx location

* Change nonexample image tags

* Set correct nonexample image tag

* Change tag for nonexample image

* Change dockerfile name

* Rename dockerfile for release images

* Move stable build to dockerfile

* Refactoring bake file
This commit is contained in:
Danil Titarenko 2022-08-29 11:40:25 +03:00 committed by GitHub
parent 2379128240
commit 207bd5dac7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 91 additions and 10 deletions

View file

@ -13,7 +13,7 @@ env:
jobs: jobs:
build: build:
name: Build name: "Build image: DocumentServer${{ matrix.edition }}"
runs-on: ubuntu-latest runs-on: ubuntu-latest
continue-on-error: ${{ matrix.condition }} continue-on-error: ${{ matrix.condition }}
strategy: strategy:
@ -33,7 +33,7 @@ jobs:
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKER_HUB_USERNAME }} username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

View file

@ -12,7 +12,7 @@ env:
jobs: jobs:
build: build:
name: Build name: "Release image: DocumentServer${{ matrix.edition }}"
runs-on: ubuntu-latest runs-on: ubuntu-latest
continue-on-error: ${{ matrix.condition }} continue-on-error: ${{ matrix.condition }}
strategy: strategy:
@ -31,7 +31,7 @@ jobs:
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKER_HUB_USERNAME }} username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
@ -49,9 +49,9 @@ jobs:
IMAGE_STATUS=$(docker manifest inspect ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$TAG > /dev/null ; echo $?) IMAGE_STATUS=$(docker manifest inspect ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$TAG > /dev/null ; echo $?)
if [[ "$IMAGE_STATUS" = "0" ]]; then if [[ "$IMAGE_STATUS" = "0" ]]; then
echo "Image present on docker.hub >> start build stable version" echo "Image present on docker.hub >> start build stable version"
echo "FROM ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$TAG as ${{ env.PRODUCT_NAME }}-stable" >> Dockerfile.stable PRODUCT_EDITION=${{ matrix.edition }} \
PRODUCT_EDITION=${{ matrix.edition }} PRODUCT_NAME=${{ env.PRODUCT_NAME }} \ PRODUCT_NAME=${{ env.PRODUCT_NAME }} \
COMPANY_NAME=${{ env.COMPANY_NAME}} DOCKERFILE=Dockerfile.stable \ COMPANY_NAME=${{ env.COMPANY_NAME}} \
TAG=$TAG \ TAG=$TAG \
SHORTER_TAG=$SHORTER_TAG \ SHORTER_TAG=$SHORTER_TAG \
SHORTEST_TAG=$SHORTEST_TAG \ SHORTEST_TAG=$SHORTEST_TAG \
@ -65,3 +65,46 @@ jobs:
exit 1 exit 1
fi fi
shell: bash shell: bash
build-nonExample:
name: "Release image: DocumentServer${{ matrix.edition }}-nonExample"
runs-on: ubuntu-latest
needs: [build]
continue-on-error: ${{ matrix.condition }}
strategy:
matrix:
images: ["documentserver-nonexample"]
edition: ["", "-ee", "-de"]
condition: [true]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Get Tag Name
id: tag_name
run: |
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: build image
run: |
TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//; s/-stable//')
PRODUCT_EDITION=${{ matrix.edition }} \
PRODUCT_NAME=${{ env.PRODUCT_NAME }} \
COMPANY_NAME=${{ env.COMPANY_NAME }} \
TAG=$TAG \
docker buildx bake \
-f docker-bake.hcl ${{ matrix.images }} \
--push
shell: bash

24
Dockerfile.production Normal file
View file

@ -0,0 +1,24 @@
### Arguments avavlivable only for FROM instruction ###
ARG TAG=latest
ARG COMPANY_NAME=onlyoffice
ARG PRODUCT_EDITION=
### Build main-release ###
FROM ${COMPANY_NAME}/4testing-documentserver${PRODUCT_EDITION}:${TAG} as documentserver-stable
### Build nonexample ###
FROM ${COMPANY_NAME}/documentserver${PRODUCT_EDITION}:${TAG} as documentserver-nonexample
ARG COMPANY_NAME=onlyoffice
ARG PRODUCT_NAME=documentserver
ARG DS_SUPERVISOR_CONF=/etc/supervisor/conf.d/ds.conf
### Remove all documentserver-example data ###
RUN rm -rf /var/www/$COMPANY_NAME/$PRODUCT_NAME-example \
&& rm -rf /etc/$COMPANY_NAME/$PRODUCT_NAME-example \
&& rm -f $DS_SUPERVISOR_CONF \
&& rm -f /etc/nginx/includes/ds-example.conf \
&& ln -s /etc/$COMPANY_NAME/$PRODUCT_NAME/supervisor/ds.conf $DS_SUPERVISOR_CONF

View file

@ -61,15 +61,29 @@ target "documentserver" {
target "documentserver-stable" { target "documentserver-stable" {
target = "documentserver-stable" target = "documentserver-stable"
dockerfile= "${DOCKERFILE}" dockerfile= "Dockerfile.production"
tags = ["docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}", tags = ["docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}",
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${SHORTER_TAG}", "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${SHORTER_TAG}",
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${SHORTEST_TAG}", "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${SHORTEST_TAG}",
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest"] "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest"]
platforms = ["linux/amd64", "linux/arm64"] platforms = ["linux/amd64", "linux/arm64"]
args = { args = {
"PRODUCT_EDITION": "${PRODUCT_EDITION}" "TAG": "${TAG}"
"PRODUCT_NAME": "${PRODUCT_NAME}"
"COMPANY_NAME": "${COMPANY_NAME}" "COMPANY_NAME": "${COMPANY_NAME}"
"PRODUCT_NAME": "${PRODUCT_NAME}"
"PRODUCT_EDITION": "${PRODUCT_EDITION}"
} }
} }
target "documentserver-nonexample" {
target = "documentserver-nonexample"
dockerfile = "Dockerfile.production"
tags = [ "docker.io/${COMPANY_NAME}/${PRODUCT_NAME}${PREFIX_NAME}${PRODUCT_EDITION}:${TAG}-nonexample" ]
platforms = ["linux/amd64", "linux/arm64"]
args = {
"TAG": "${TAG}"
"COMPANY_NAME": "${COMPANY_NAME}"
"PRODUCT_NAME": "${PRODUCT_NAME}"
"PRODUCT_EDITION": "${PRODUCT_EDITION}"
}
}