feat(docker): production images, integrated ccache and many other improvements (#5551)

This commit is contained in:
Yehonal
2021-05-04 11:35:24 +02:00
committed by GitHub
parent a1b0c45417
commit f6c6123d85
34 changed files with 569 additions and 123 deletions

View File

@@ -59,7 +59,7 @@ jobs:
- name: Cache
uses: actions/cache@v2
with:
path: /home/runner/.ccache
path: var/ccache
key: ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ matrix.modules }}-modules:${{ github.ref }}:${{ github.sha }}
restore-keys: |
ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ matrix.modules }}-modules:${{ github.ref }}

View File

@@ -12,9 +12,6 @@ jobs:
runs-on: ubuntu-20.04
if: github.repository == 'azerothcore/azerothcore-wotlk'
env:
DOCKER_EXTENDS_BIND: abstract-no-bind
DOCKER_BUILD_WORLD_TARGET: worldserver
DOCKER_BUILD_AUTH_TARGET: authserver
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
BUILDKIT_INLINE_CACHE: 1
@@ -29,14 +26,37 @@ jobs:
- name: Configure
run: |
sudo rm -rf /usr/share/dotnet
docker --version
docker-compose --version
- name: Build
# TODO: make it work
# - uses: whoan/docker-build-with-cache-action@v5
# with:
# image_tag: master
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# compose_file: docker-compose.yml
# before cache
# needed to avoid ccache injected into these images
- name: Build Dev
env:
#DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }}
DOCKER_EXTENDS_BIND: abstract-no-bind
DOCKER_CLIENT_TIMEOUT: 400
COMPOSE_HTTP_TIMEOUT: 400
run: |
export DOCKER_USER_ID=$(id -u)
export DOCKER_GROUP_ID=$(id -u)
docker-compose --profile dev --profile local build --parallel
- name: Deploy Dev
#env:
# DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }}
if: ${{ steps.extract_branch.outputs.branch == 'master' }}
run: |
docker-compose --profile all build
docker-compose --profile dev --profile local push
- name: Login to Docker Hub
if: ${{ steps.extract_branch.outputs.branch == 'master' }}
@@ -45,9 +65,33 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Deploy
- name: Cache
uses: actions/cache@v2
with:
path: var/docker/ccache
key: ccache:ubuntu-20.04:clang:without-modules:${{ github.ref }}:${{ github.sha }}
restore-keys: |
ccache:ubuntu-20.04:clang:without-modules:${{ github.ref }}
ccache:ubuntu-20.04:clang:without-modules
- name: Build Production images
env:
#DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }}
DOCKER_EXTENDS_BIND: abstract-no-bind
DOCKER_AC_BUILD_TARGET: build
DOCKER_CLIENT_TIMEOUT: 220
COMPOSE_HTTP_TIMEOUT: 220
run: |
export DOCKER_USER_ID=$(id -u)
export DOCKER_GROUP_ID=$(id -u)
docker-compose --profile build --profile prod build --parallel
docker-compose run --no-deps --name build ac-build echo "image created"
docker cp build:/azerothcore/var/ccache var/docker/
echo "ccache exported"
- name: Deploy Production images
#env:
# DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }}
if: ${{ steps.extract_branch.outputs.branch == 'master' }}
run: |
docker-compose --profile all push
docker-compose --profile prod push