Some checks failed
check / stable / fmt (push) Successful in 45s
check / beta / clippy (push) Failing after 51s
check / stable / clippy (push) Failing after 47s
check / semver (push) Failing after 5m38s
check / nightly / doc (push) Successful in 2m12s
check / ubuntu / stable / features (push) Successful in 2m21s
check / ubuntu / 1.79.0 (push) Failing after 27s
I don't really know how I did that, or how I got a build up on Fly.io without committing the fix. Well, anyway... it's done now.
26 lines
996 B
Docker
26 lines
996 B
Docker
FROM rust:1.89 AS builder
|
|
|
|
RUN apt-get update
|
|
RUN apt-get install -y --no-install-recommends libasound2-dev libudev-dev
|
|
RUN rustup target add wasm32-unknown-unknown
|
|
RUN cargo install --locked wasm-bindgen-cli
|
|
|
|
# Copy only the package manifest and source code. Otherwise changes to anything
|
|
# will cause Docker to re-run `cargo build` even when the source hasn't changed.
|
|
COPY src/ ./src
|
|
COPY Cargo.toml ./Cargo.toml
|
|
COPY Cargo.lock ./Cargo.lock
|
|
|
|
RUN cargo build --locked --target wasm32-unknown-unknown --profile=wasm-release
|
|
RUN wasm-bindgen --no-typescript --target web --out-dir ./out/ --out-name "boids" target/wasm32-unknown-unknown/wasm-release/another-boids-in-rust.wasm
|
|
COPY www/index.html out/index.html
|
|
|
|
FROM busybox:musl
|
|
RUN mkdir -p /var/www
|
|
COPY --from=builder ./out/ /var/www
|
|
WORKDIR /var/www
|
|
|
|
# TODO: Make httpd accept interrupt signals so the container exits properly.
|
|
# (<ctrl>+c and `docker stop ...` don't work because Busybox doesn't answer)
|
|
CMD ["httpd", "-f", "-p", "8080"]
|