2023-02-23 11:09:27 +00:00
|
|
|
FROM docker.io/rust:1.67-alpine3.17 AS builder
|
|
|
|
|
2023-03-09 07:50:55 +00:00
|
|
|
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
|
|
|
|
2023-02-23 11:09:27 +00:00
|
|
|
RUN apk add --no-cache \
|
2023-03-09 07:50:55 +00:00
|
|
|
musl-dev \
|
2023-03-09 09:36:11 +00:00
|
|
|
wasm-pack \
|
|
|
|
make
|
2023-03-09 07:50:55 +00:00
|
|
|
|
|
|
|
RUN rustup target add wasm32-unknown-unknown
|
2023-02-23 11:09:27 +00:00
|
|
|
|
|
|
|
ADD . /src
|
|
|
|
WORKDIR /src
|
|
|
|
|
2023-03-09 09:36:11 +00:00
|
|
|
RUN make release
|
2023-02-23 11:09:27 +00:00
|
|
|
|
|
|
|
RUN adduser -D woweb
|
|
|
|
|
2023-03-09 09:36:11 +00:00
|
|
|
RUN sed -i 's|ws://localhost:3000/ws|wss://woweb.vanwa.ch/ws|' dist/assets/index.js
|
2023-02-23 11:09:27 +00:00
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
|
|
|
|
COPY --from=builder /etc/passwd /etc/passwd
|
2023-03-09 09:36:11 +00:00
|
|
|
COPY --from=builder /src/dist/woweb "/opt/woweb"
|
|
|
|
COPY --from=builder /src/dist/assets "/opt/assets"
|
2023-02-23 11:09:27 +00:00
|
|
|
|
|
|
|
EXPOSE 3000
|
|
|
|
|
|
|
|
WORKDIR /opt
|
|
|
|
USER woweb
|
2023-03-09 07:35:24 +00:00
|
|
|
CMD ["/opt/woweb", "0.0.0.0:3000"]
|