Fix Docker build and add multi-platform support (#29)
* Specify node:lts-alpine tag to fix build error * Attempt to remove dependency on rust-musl-builder * Remove rustpad-server specifier
This commit is contained in:
parent
ae3f9658ad
commit
204b084e62
5 changed files with 12 additions and 7 deletions
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
|
@ -13,6 +13,9 @@ jobs:
|
|||
name: Docker Build and Push
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
FROM ekidd/rust-musl-builder:latest as backend
|
||||
FROM rust:alpine as backend
|
||||
WORKDIR /home/rust/src
|
||||
RUN apk --no-cache add musl-dev openssl-dev
|
||||
COPY . .
|
||||
RUN cargo test --release
|
||||
RUN cargo build --release
|
||||
|
@ -11,7 +12,7 @@ RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|||
COPY . .
|
||||
RUN wasm-pack build rustpad-wasm
|
||||
|
||||
FROM node:alpine as frontend
|
||||
FROM 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
|
||||
|
@ -23,6 +24,6 @@ RUN npm run build
|
|||
|
||||
FROM scratch
|
||||
COPY --from=frontend /usr/src/app/build build
|
||||
COPY --from=backend /home/rust/src/target/x86_64-unknown-linux-musl/release/rustpad-server .
|
||||
COPY --from=backend /home/rust/src/target/release/rustpad-server .
|
||||
USER 1000:1000
|
||||
CMD [ "./rustpad-server" ]
|
||||
|
|
|
@ -103,8 +103,9 @@ docker pull ekzhang/rustpad
|
|||
```
|
||||
|
||||
(You can also manually build this image with `docker build -t rustpad .` in the
|
||||
project root directory.) To run locally, execute the following command, then
|
||||
open `http://localhost:3030` in your browser.
|
||||
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.
|
||||
|
||||
```
|
||||
docker run --rm -dp 3030:3030 ekzhang/rustpad
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
name = "rustpad-server"
|
||||
version = "0.1.0"
|
||||
authors = ["Eric Zhang <ekzhang1@gmail.com>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.40"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
name = "rustpad-wasm"
|
||||
version = "0.1.0"
|
||||
authors = ["Eric Zhang <ekzhang1@gmail.com>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
|
Loading…
Reference in a new issue