32 lines
625 B
Docker
32 lines
625 B
Docker
FROM docker.io/rust:1.67-alpine3.17 AS builder
|
|
|
|
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
|
|
|
RUN apk add --no-cache \
|
|
musl-dev \
|
|
wasm-pack
|
|
|
|
RUN rustup target add wasm32-unknown-unknown
|
|
|
|
ADD . /src
|
|
WORKDIR /src
|
|
|
|
RUN cargo build --release
|
|
RUN strip target/release/woweb
|
|
|
|
RUN adduser -D woweb
|
|
|
|
RUN sed -i 's|ws://localhost:3000/ws|wss://woweb.vanwa.ch/ws|' woweb/assets/index.js
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=builder /etc/passwd /etc/passwd
|
|
COPY --from=builder /src/target/release/woweb "/opt/woweb"
|
|
COPY --from=builder /src/woweb/assets "/opt/assets"
|
|
|
|
EXPOSE 3000
|
|
|
|
WORKDIR /opt
|
|
USER woweb
|
|
CMD ["/opt/woweb", "0.0.0.0:3000"]
|