Skip to content

Commit

Permalink
Docker image for multiple platform (#141), and add to release (#169).
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoFara committed Jan 3, 2024
2 parents e31d838 + 3b4c90b commit 0931bfd
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 3 deletions.
71 changes: 69 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Docker image

on:
release:
types: [ published ]
push:
branches: [ 'master' ]
tags:
Expand All @@ -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:
Expand All @@ -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 }}
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ ARG DB_HOSTNAME=db
ARG DB_USER=root
ARG DB_PASSWORD=root
ARG DB_DATABASE=learning-with-texts
RUN printf '<?php\n$server = "%s";\n$userid = "%s";\n$passwd = "%s";\n$dbname = "%s";\n?>' "$DB_HOSTNAME" "$DB_USER" "$DB_PASSWORD" "$DB_DATABASE" > /var/www/html/lwt/connect.inc.php

RUN printf '<?php\n$server = "%s";\n$userid = "%s";\n$passwd = "%s";\n$dbname = "%s";\n?>' "$DB_HOSTNAME" "$DB_USER" "$DB_PASSWORD" "$DB_DATABASE" > /var/www/html/lwt/connect.inc.php

4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions docs/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -2254,6 +2254,9 @@ <h4>Added</h4>
<code>db/schema/baseline.sql</code> and no longer in PHP code.</li>
<li>You can choose to add romanization for languages that don't need it in the language
settings (<a href="https://github.com/HugoFara/lwt/issues/119">#119</a>).</li>
<li>Docker images are now built for multiple platforms, see
<a href="https://github.com/HugoFara/lwt/pull/169">#159</a>.
Many thanks to <a href="https://github.com/ProgramComputer">@ProgramComputer</a>!</li>
</ul>
<h4>Changed</h4>
<ul>
Expand Down

0 comments on commit 0931bfd

Please sign in to comment.