woweb-poc/Dockerfile

32 lines
582 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 \
make
RUN rustup target add wasm32-unknown-unknown
ADD . /src
WORKDIR /src
RUN make release
RUN adduser -D woweb
RUN sed -i 's|ws://localhost:3000/ws|wss://woweb.vanwa.ch/ws|' dist/assets/index.js
FROM scratch
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /src/dist/woweb "/opt/woweb"
COPY --from=builder /src/dist/assets "/opt/assets"
EXPOSE 3000
WORKDIR /opt
USER woweb
CMD ["/opt/woweb", "0.0.0.0:3000"]