Add multi-platform build support for linux/arm64 (#32)

* Add multi-platform build support for linux/arm64

* Update README and simplify QEMU platforms

* Update frontend dependencies and clippy lints (#33)

* Only build ARM64 images on pushes to main
This commit is contained in:
Eric Zhang 2021-12-27 16:16:57 -06:00 committed by GitHub
parent 7cc5b9c939
commit 2caf088167
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View File

@ -18,6 +18,8 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
@ -32,6 +34,8 @@ jobs:
id: docker_build
uses: docker/build-push-action@v2
with:
platforms: |
${{ github.event_name == 'push' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
push: ${{ github.event_name == 'push' }}
build-args: GITHUB_SHA
tags: ekzhang/rustpad:latest

View File

@ -5,14 +5,14 @@ COPY . .
RUN cargo test --release
RUN cargo build --release
FROM rust:alpine as wasm
FROM amd64/rust:alpine as wasm
WORKDIR /home/rust/src
RUN apk --no-cache add curl musl-dev
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
COPY . .
RUN wasm-pack build --target web rustpad-wasm
FROM node:lts-alpine as frontend
FROM amd64/node:lts-alpine as frontend
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
COPY --from=wasm /home/rust/src/rustpad-wasm/pkg rustpad-wasm/pkg

View File

@ -96,16 +96,16 @@ following environment variables on startup:
Rustpad is distributed as a single 6 MB Docker image, which is built
automatically from the `Dockerfile` in this repository. You can pull the latest
version of this image from Docker Hub.
version of this image from Docker Hub. It has multi-platform support for
`linux/amd64` and `linux/arm64`.
```
docker pull ekzhang/rustpad
```
(You can also manually build this image with `docker build -t rustpad .` in the
project root directory, ensuring that your target platform is `linux/amd64`.) To
run locally, execute the following command, then open `http://localhost:3030` in
your browser.
project root directory.) To run locally, execute the following command, then
open `http://localhost:3030` in your browser.
```
docker run --rm -dp 3030:3030 ekzhang/rustpad