Skip to content

self-hosted multiarch-build #26

self-hosted multiarch-build

self-hosted multiarch-build #26

name: self-hosted multiarch-build
on:
workflow_dispatch:
env:
DOCKER_PATH: "/install/docker"
REPO: "lemmav"
DOCKER_IMAGE_PREFIX: "4testing-docspace"
DOCKERFILE: "Dockerfile.app"
FILE: "build.yml"
PRODUCT_NAME: "4testing-docspace-socket"
REGISTRY_URL: "https://hub.docker.com/v2/repositories"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Free Disk Space
run: |
sudo rm -rf /usr/local/lib/android /opt/ghc
sudo docker image prune --all --force
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Test Container
run: |
echo "test ${{github.head_ref}}"
cd .${DOCKER_PATH}
NETWORK_NAME="onlyoffice"
NETWORK_EXISTS=$(docker network ls --filter name=$NETWORK_NAME -q)
if [ -z "$NETWORK_EXISTS" ]; then
echo "Creating Docker network: $NETWORK_NAME"
docker network create -d bridge $NETWORK_NAME
else
echo "Docker network $NETWORK_NAME already exists."
fi
sleep 10
docker-compose -f db.yml up -d
sleep 10
docker-compose -f elasticsearch.yml up -d
sleep 10
docker-compose -f redis.yml up -d
sleep 10
docker-compose -f rabbitmq.yml up -d
sleep 10
docker-compose -f healthchecks.yml up -d
sleep 10
docker-compose -f migration-runner.yml up -d
sleep 10
docker-compose -f docspace.yml up -d
sleep 10
docker-compose -f notify.yml up -d
HAS_ERROR=false
CONTAINER_NAMES=$(docker-compose -f docspace.yml ps --all | grep onlyoffice | awk '{print $1}')
for CONTAINER_NAME in $CONTAINER_NAMES; do
CONTAINER_STATUS=$(docker inspect -f '{{.State.Status}}' $CONTAINER_NAME)
if [ "$CONTAINER_NAME" == "onlyoffice-migration-runner" ] ; then
if [ "$CONTAINER_STATUS" == "exited" ] ; then
echo "$CONTAINER_NAME container has successfully exited." >> logs.txt
else
echo "Error: $CONTAINER_NAME container is $CONTAINER_STATUS." >> logs.txt
HAS_ERROR=true
fi
else
if [ "$CONTAINER_STATUS" == "running" ] ; then
echo "$CONTAINER_NAME container is running." >> logs.txt
else
echo "Error: $CONTAINER_NAME container is $CONTAINER_STATUS." >> logs.txt
HAS_ERROR=true
fi
fi
done
if [ "$HAS_ERROR" = true ]; then
exit 1
fi
echo "artifactPath=$PWD" >> $GITHUB_ENV
shell: bash
- uses: actions/upload-artifact@v3
with:
name: logs
path: ${{ env.artifactPath }}/logs.txt