diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 65fdaea..78f9c16 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -130,8 +130,8 @@ jobs: cache-to: type=gha,mode=max,scope=base_linux/${{ matrix.platform }}-${{ matrix.dockerfile }} tags: baseonly - base_cpan_build: - needs: [get_dependencies, base_build] + cpan_build: + needs: [get_dependencies] runs-on: ubuntu-latest strategy: matrix: @@ -175,7 +175,7 @@ jobs: GHCR_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} DOCKERFILE: ${{ matrix.dockerfile }} - - name: Build base cpan layer for ${{ matrix.platform }} + - name: Build cpan packages for ${{ matrix.platform }} uses: docker/build-push-action@v5 with: context: . @@ -185,10 +185,10 @@ jobs: push: false target: base-cpan cache-from: | - type=gha,scope=base_linux/${{ matrix.platform }}-${{ matrix.dockerfile }} + type=gha,scope=build_linux/${{ matrix.platform }}-${{ matrix.dockerfile }} type=gha,scope=base-cpan_linux/${{ matrix.platform }}-${{ matrix.dockerfile }} cache-to: type=gha,mode=max,scope=base-cpan_linux/${{ matrix.platform }}-${{ matrix.dockerfile }} - tags: basecpanonly + tags: buildcpanonly test_build: @@ -254,6 +254,30 @@ jobs: type=ref,event=branch,suffix=${{ matrix.dockerfile }} type=ref,event=pr,suffix=${{ matrix.dockerfile }} + - name: Build and cache fhem base layer + uses: docker/build-push-action@v5 + id: docker_build_fhem + with: + context: . + load: true + file: ./Dockerfile${{ matrix.dockerfile }} + platforms: linux/amd64 + push: false + target: with-fhem-bats + cache-from: | + type=gha,scope=fhem_linux/amd64-${{ matrix.dockerfile }} + type=gha,scope=base_linux/amd64-${{ matrix.dockerfile }} + cache-to: type=gha,mode=max,scope=fhem_linux/amd64-${{ matrix.dockerfile }} + tags: with-fhem + labels: ${{ steps.meta.outputs.labels }} + build-args: | + BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} + IMAGE_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} + IMAGE_VCS_REF=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} + L_USAGE=${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/README.md + L_VCS_URL=${{ github.server_url }}/${{ github.repository }}/ + L_AUTHORS=${{ github.server_url }}/${{ github.repository }}/graphs/contributors + - name: Build for bats with fhem base layer uses: docker/build-push-action@v5 id: docker_build_bats @@ -265,9 +289,7 @@ jobs: push: false target: with-fhem-bats cache-from: | - type=gha,scope=base_linux/amd64-${{ matrix.dockerfile }} - type=gha,scope=full_linux/amd64-${{ matrix.dockerfile }} - cache-to: type=gha,mode=max,scope=full_linux/amd64-${{ matrix.dockerfile }} + type=gha,scope=fhem_linux/amd64-${{ matrix.dockerfile }} tags: bats-withfhem labels: ${{ steps.meta.outputs.labels }} build-args: | @@ -301,8 +323,8 @@ jobs: push: false target: with-fhem-extended-python-nodejs cache-from: | - type=gha,scope=base_linux/amd64-${{ matrix.dockerfile }} - type=gha,scope=full_linux/amd64-${{ matrix.dockerfile }} + type=gha,scope=full_linux/amd64-${{ matrix.dockerfile }} + type=gha,scope=fhem_linux/amd64-${{ matrix.dockerfile }} cache-to: type=gha,mode=max,scope=full_linux/amd64-${{ matrix.dockerfile }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -333,7 +355,7 @@ jobs: published_build: runs-on: ubuntu-latest - needs: [test_build, base_cpan_build] + needs: [test_build, cpan_build] strategy: matrix: dockerfile: [-bullseye, -threaded-bullseye] @@ -397,10 +419,11 @@ jobs: context: . load: false file: ./Dockerfile${{ matrix.dockerfile }} - platforms: linux/amd64,linux/arm/v7,linux/arm64 + platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386 push: ${{ github.event_name != 'pull_request' }} target: with-fhem-extended-python-nodejs cache-from: | + type=gha,scope=base-cpan_linux/386-${{ matrix.dockerfile }} type=gha,scope=base-cpan_linux/arm64-${{ matrix.dockerfile }} type=gha,scope=base-cpan_linux/arm/v7-${{ matrix.dockerfile }} type=gha,scope=full_linux/amd64-${{ matrix.dockerfile }} @@ -440,17 +463,16 @@ jobs: context: . load: false file: ./Dockerfile${{ matrix.dockerfile }} - platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64 + platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64,386 push: ${{ github.event_name != 'pull_request' }} target: with-fhem cache-from: | type=gha,scope=base_linux/arm64-${{ matrix.dockerfile }} type=gha,scope=base_linux/amd64-${{ matrix.dockerfile }} type=gha,scope=base_linux/arm/v7-${{ matrix.dockerfile }} + type=gha,scope=base_linux/386-${{ matrix.dockerfile }} type=gha,scope=full_linux/amd64-${{ matrix.dockerfile }} type=gha,scope=full_linux/cross-${{ matrix.dockerfile }} - type=gha,scope=base_linux/cross-${{ matrix.dockerfile }} - cache-to: type=gha,mode=max,scope=base_linux/cross-${{ matrix.dockerfile }} tags: ${{ steps.meta_base.outputs.tags }} labels: ${{ steps.meta_base.outputs.labels }} build-args: | diff --git a/Dockerfile-bullseye b/Dockerfile-bullseye index a2389a6..af4257c 100644 --- a/Dockerfile-bullseye +++ b/Dockerfile-bullseye @@ -2,7 +2,7 @@ # # base layer with perl and some general preparations # -FROM perl:5.36.3-bullseye@sha256:e341d89b87dbf8caf8a3e33e8d606e1cb4f975d43553a083040fae3402d078c3 as base +FROM perl:5.36.3-slim-bullseye as base ARG TARGETPLATFORM @@ -28,9 +28,7 @@ RUN </etc/locale.gen @@ -48,10 +46,41 @@ EOF # Install all CPAN Modules, needed from FHEM and standard modules # -FROM base as base-cpan +FROM perl:5.36.3-bullseye as build-cpan COPY cpanfile /usr/src/app/core-cpanfile +# Install Packages used for building cpan modules: +RUN </etc/locale.gen @@ -48,10 +46,41 @@ EOF # Install all CPAN Modules, needed from FHEM and standard modules # -FROM base as base-cpan +FROM perl:5.36.3-threaded-buster as build-cpan COPY cpanfile /usr/src/app/core-cpanfile +# Install Packages used for building cpan modules: +RUN <