diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 58d8b5169..3955726d7 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,6 +1,8 @@ name: Docker image on: + release: + types: [ published ] push: branches: [ 'master' ] tags: @@ -11,16 +13,80 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: - build-and-push-image: + build-and-upload-image-to-release: + permissions: + contents: write + packages: write + release: write runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + # For platform support change, change here and below + platform: + - linux/amd64 + - linux/386 + - linux/arm/v5 + - linux/arm/v7 + - linux/arm64 + - linux/mips64le + - linux/ppc64le + - linux/s390x + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build Docker images + uses: docker/build-push-action@v3 + with: + context: . + platforms: ${{ matrix.platform }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=oci,dest=/tmp/image.tar + if: ${{ github.event_name == 'release'}} + - name: Upload binaries to release + if: ${{ github.event_name == 'release'}} + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{secrets.GITHUB_TOKEN }} + file: /tmp/image.tar + asset_name: ${{ github.ref_name }}-${{ matrix.platform }} + tag: ${{ github.ref }} + build-and-push-image: permissions: - contents: read packages: write + runs-on: ubuntu-latest + strategy: + fail-fast: false steps: + - name: Checkout repository uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to the Container registry uses: docker/login-action@v2 with: @@ -39,5 +105,6 @@ jobs: with: context: . push: true + platforms: linux/amd64,linux/386,linux/arm/v5,linux/arm/v7,linux/arm64,linux/mips64le,linux/ppc64le,linux/s390x tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index b7d159409..d1f6aff3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,4 +16,6 @@ ARG DB_HOSTNAME=db ARG DB_USER=root ARG DB_PASSWORD=root ARG DB_DATABASE=learning-with-texts -RUN printf '' "$DB_HOSTNAME" "$DB_USER" "$DB_PASSWORD" "$DB_DATABASE" > /var/www/html/lwt/connect.inc.php \ No newline at end of file + +RUN printf '' "$DB_HOSTNAME" "$DB_USER" "$DB_PASSWORD" "$DB_DATABASE" > /var/www/html/lwt/connect.inc.php + diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index b20c9e50f..1d9723f70 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -33,6 +33,10 @@ ones are marked like "v1.0.0-fork". `db/schema/baseline.sql` and no longer in PHP code. * You can choose to add romanization for languages that don't need it in the language settings ([#119](https://github.com/HugoFara/lwt/issues/119)). +* Docker images are now built for multiple platforms, see PR +[#169](https://github.com/HugoFara/lwt/pull/169), closing discussion +[#141](https://github.com/HugoFara/lwt/discussions/141). +Many thanks to [@ProgramComputer](https://github.com/ProgramComputer)! ### Changed diff --git a/docs/info.html b/docs/info.html index 011ac4059..875de7a32 100644 --- a/docs/info.html +++ b/docs/info.html @@ -2254,6 +2254,9 @@
db/schema/baseline.sql
and no longer in PHP code.