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:
parent
7cc5b9c939
commit
2caf088167
3 changed files with 10 additions and 6 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -18,6 +18,8 @@ jobs:
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
|
with:
|
||||||
|
platforms: arm64
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
|
@ -32,6 +34,8 @@ jobs:
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
|
platforms: |
|
||||||
|
${{ github.event_name == 'push' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
|
||||||
push: ${{ github.event_name == 'push' }}
|
push: ${{ github.event_name == 'push' }}
|
||||||
build-args: GITHUB_SHA
|
build-args: GITHUB_SHA
|
||||||
tags: ekzhang/rustpad:latest
|
tags: ekzhang/rustpad:latest
|
||||||
|
|
|
@ -5,14 +5,14 @@ COPY . .
|
||||||
RUN cargo test --release
|
RUN cargo test --release
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
FROM rust:alpine as wasm
|
FROM amd64/rust:alpine as wasm
|
||||||
WORKDIR /home/rust/src
|
WORKDIR /home/rust/src
|
||||||
RUN apk --no-cache add curl musl-dev
|
RUN apk --no-cache add curl musl-dev
|
||||||
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN wasm-pack build --target web rustpad-wasm
|
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
|
WORKDIR /usr/src/app
|
||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
COPY --from=wasm /home/rust/src/rustpad-wasm/pkg rustpad-wasm/pkg
|
COPY --from=wasm /home/rust/src/rustpad-wasm/pkg rustpad-wasm/pkg
|
||||||
|
|
|
@ -96,16 +96,16 @@ following environment variables on startup:
|
||||||
|
|
||||||
Rustpad is distributed as a single 6 MB Docker image, which is built
|
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
|
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
|
docker pull ekzhang/rustpad
|
||||||
```
|
```
|
||||||
|
|
||||||
(You can also manually build this image with `docker build -t rustpad .` in the
|
(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
|
project root directory.) To run locally, execute the following command, then
|
||||||
run locally, execute the following command, then open `http://localhost:3030` in
|
open `http://localhost:3030` in your browser.
|
||||||
your browser.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run --rm -dp 3030:3030 ekzhang/rustpad
|
docker run --rm -dp 3030:3030 ekzhang/rustpad
|
||||||
|
|
Loading…
Add table
Reference in a new issue