Skip to content

Fix build

Fix build #7

name: DocSpace services build and push
on:
push:
branches:
- 'hotfix/v*'
- 'release/v*'
- 'develop'
paths:
- '.github/workflows/docker-build-test.yml'
workflow_dispatch:
env:
DOCKER_PATH: "/docker"
REPO: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_IMAGE_PREFIX: "4testing-docspace"
IMAGE_NAME_SRC: "4testing-docspace-src"
DOCKERFILE: "./docker/Dockerfile.app"
DOCKER_TAG: develop
TAG: "1.0.2"
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- 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: Show prebuild free space
id: start-statistics
run: |
cd .${DOCKER_PATH}
DOCKER_TAG=develop.${{ github.run_number }}
export DOCKER_TAG
ls -la
df -h
pwd
# docker buildx build . -f "Dockerfile.app" -t sk81biz/4testing-docspace-file-services:1.0.1 --build-arg GIT_BRANCH="develop"\
# --platform=${{ matrix.platform }} --target src-test --push
# echo "version=${DOCKER_TAG}" >> "$GITHUB_OUTPUT"
shell: bash
# - name: Build and push
# uses: docker/build-push-action@v6
# with:
# context: .
# platforms: ${{ matrix.platform }}
# push: true
# target: src-test
# file: ${{ env.DOCKERFILE }}
# tags: ${{ secrets.DOCKERHUB_USERNAME }}/4testing-docspace-src:${{ env.DOCKER_TAG }}
# build-args: GIT_BRANCH=develop
-
name: Build and push
uses: docker/build-push-action@v6
id: build-src
with:
context: .
platforms: ${{ matrix.platform }}
target: src-test
file: ${{ env.DOCKERFILE }}
build-args: GIT_BRANCH=develop
outputs: type=image,name=${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME_SRC }},push-by-digest=true,name-canonical=true,push=true
-
name: Export digest
run: |
mkdir -p /tmp/digests/${{ env.IMAGE_NAME_SRC }}
digest="${{ steps.build-src.outputs.digest }}"
touch "/tmp/digests/${{ env.IMAGE_NAME_SRC }}/${digest#sha256:}"
-
name: Upload digest
uses: actions/upload-artifact@v3
with:
name: digests
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Create ${{ env.IMAGE_NAME_SRC }} list and push
working-directory: /tmp/digests/${{ env.IMAGE_NAME_SRC }}
run: |
docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME_SRC }}:${{ env.TAG }} \
$(printf '${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME_SRC }}@sha256:%s ' *)
# - name: Show free space
# id: end-statistics
# run: |
# df -h
# docker system info
# docker image ls
# docker system df
# docker buildx bake -f build.yml \
# --set *.args.GIT_BRANCH=${{ github.GITHUB_REF_NAME }} \
# --set *.args.PRODUCT_VERSION=${PRODUCT_VERSION} \
# --set *.args.BUILD_NUMBER=${BUILD_NUMBER} \
# --set *.platform=${{ matrix.platform }} \
# --set *.platform=${{ matrix.platform }} \
# --set *.args.PRODUCT_VERSION=${PRODUCT_VERSION} \
# --set *.args.BUILD_NUMBER=${{github.run_number}} \
# --push
# echo "version=${DOCKER_TAG}" >> "$GITH