diff --git a/.github/workflows/4testing-build.yml b/.github/workflows/4testing-build.yml index 1a985db..b5a9956 100644 --- a/.github/workflows/4testing-build.yml +++ b/.github/workflows/4testing-build.yml @@ -13,7 +13,7 @@ env: jobs: build: - name: Build + name: "Build image: DocumentServer${{ matrix.edition }}" runs-on: ubuntu-latest continue-on-error: ${{ matrix.condition }} strategy: @@ -33,7 +33,7 @@ jobs: uses: docker/setup-buildx-action@v2 - name: Login to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} diff --git a/.github/workflows/stable-build.yml b/.github/workflows/stable-build.yml index 7fd434a..9d7f6df 100644 --- a/.github/workflows/stable-build.yml +++ b/.github/workflows/stable-build.yml @@ -12,7 +12,7 @@ env: jobs: build: - name: Build + name: "Release image: DocumentServer${{ matrix.edition }}" runs-on: ubuntu-latest continue-on-error: ${{ matrix.condition }} strategy: @@ -31,7 +31,7 @@ jobs: uses: docker/setup-buildx-action@v2 - name: Login to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} 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 $?) if [[ "$IMAGE_STATUS" = "0" ]]; then 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_NAME=${{ env.PRODUCT_NAME }} \ - COMPANY_NAME=${{ env.COMPANY_NAME}} DOCKERFILE=Dockerfile.stable \ + PRODUCT_EDITION=${{ matrix.edition }} \ + PRODUCT_NAME=${{ env.PRODUCT_NAME }} \ + COMPANY_NAME=${{ env.COMPANY_NAME}} \ TAG=$TAG \ SHORTER_TAG=$SHORTER_TAG \ SHORTEST_TAG=$SHORTEST_TAG \ @@ -65,3 +65,46 @@ jobs: exit 1 fi 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 diff --git a/Dockerfile.production b/Dockerfile.production new file mode 100644 index 0000000..3c7b3bd --- /dev/null +++ b/Dockerfile.production @@ -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 diff --git a/docker-bake.hcl b/docker-bake.hcl index 0302790..e7827f8 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -61,15 +61,29 @@ target "documentserver" { target "documentserver-stable" { target = "documentserver-stable" - dockerfile= "${DOCKERFILE}" + dockerfile= "Dockerfile.production" 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}:${SHORTEST_TAG}", "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest"] platforms = ["linux/amd64", "linux/arm64"] args = { - "PRODUCT_EDITION": "${PRODUCT_EDITION}" - "PRODUCT_NAME": "${PRODUCT_NAME}" + "TAG": "${TAG}" "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}" + } +}