From b18f08e8899b5a98dd3e1f8439ad812951a04cd9 Mon Sep 17 00:00:00 2001 From: Ashelyn Rose Date: Fri, 21 Mar 2025 23:15:01 -0600 Subject: Container --- docker/app.Dockerfile | 32 ++++++++++++++++++++++++++++++++ docker/builder.Dockerfile | 14 ++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 docker/app.Dockerfile create mode 100644 docker/builder.Dockerfile (limited to 'docker') diff --git a/docker/app.Dockerfile b/docker/app.Dockerfile new file mode 100644 index 0000000..66c2fe4 --- /dev/null +++ b/docker/app.Dockerfile @@ -0,0 +1,32 @@ +FROM leptos-builder-musl AS builder + +WORKDIR /build +COPY . . + +# needs to exist for clippy +RUN mkdir -p target/stormscribe +RUN cargo clippy -- -D warnings + +# RUN cargo leptos test +RUN cargo leptos build --release + + +# --------- # + + +FROM scratch AS app + +ENV LEPTOS_OUTPUT_NAME=stormscribe +ENV LEPTOS_SITE_ROOT=files +ENV LEPTOS_SITE_PKG_DIR=pkg +ENV LEPTOS_SITE_ADDR="0.0.0.0:3000" +ENV LEPTOS_RELOAD_PORT=3001 + +USER 10001 +WORKDIR /app +COPY --chown=10001:10001 --from=builder /build/target/stormscribe/ ./files/ +COPY --chown=10001:10001 --from=builder /build/target/release/stormscribe . +EXPOSE 3000 + +ENTRYPOINT ["/app/stormscribe"] + diff --git a/docker/builder.Dockerfile b/docker/builder.Dockerfile new file mode 100644 index 0000000..1df5c3e --- /dev/null +++ b/docker/builder.Dockerfile @@ -0,0 +1,14 @@ +FROM rust:1.85-alpine3.20 + +RUN apk update && \ + apk add --no-cache bash binaryen gcc git g++ libc-dev make npm openssl-dev openssl-libs-static zlib-static zlib-dev protobuf-dev protoc perl + +RUN rustup target add wasm32-unknown-unknown +RUN rustup component add clippy + +RUN cargo install cargo-generate +RUN cargo install cargo-leptos + +WORKDIR /build + +CMD /bin/bash -- cgit 1.4.1