You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.6 KiB
Docker
51 lines
1.6 KiB
Docker
FROM rust:1.86.0-bookworm AS builder
|
|
|
|
# Install cargo-binstall, which makes it easier to install other
|
|
# cargo extensions like cargo-leptos
|
|
RUN wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
|
|
RUN tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
|
|
RUN cp cargo-binstall /usr/local/cargo/bin
|
|
|
|
# Install required tools
|
|
RUN apt-get update -y \
|
|
&& apt-get install -y --no-install-recommends clang
|
|
|
|
# Install cargo-leptos
|
|
RUN cargo binstall cargo-leptos -y
|
|
|
|
RUN rustup default stable
|
|
|
|
# Add the WASM target
|
|
RUN rustup target add wasm32-unknown-unknown
|
|
#RUN rustup target add wasm32-unknown-unknown --toolchain nightly
|
|
|
|
|
|
# Make an /app dir, which everything will eventually live in
|
|
RUN mkdir -p /app
|
|
WORKDIR /app
|
|
COPY . .
|
|
|
|
# Build the app
|
|
#RUN cargo leptos build --release -vv
|
|
RUN LEPTOS_OUTPUT_NAME="rezervator-$(tr -dc a-z0-9 </dev/urandom | head -c 10)" cargo leptos build -r -P
|
|
|
|
FROM debian:bookworm-slim AS runtime
|
|
WORKDIR /app
|
|
RUN apt-get update -y \
|
|
&& apt-get install -y --no-install-recommends openssl ca-certificates \
|
|
&& apt-get autoremove -y \
|
|
&& apt-get clean -y \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy the server binary to the /app directory
|
|
COPY --from=builder /app/target/release/rezervator /app/
|
|
|
|
# /target/site contains our JS/WASM/CSS, etc.
|
|
COPY --from=builder /app/target/site /app/target/site
|
|
|
|
# Set any required env variables and
|
|
EXPOSE 3000
|
|
|
|
# -- NB: update binary name from "leptos_start" to match your app name in Cargo.toml --
|
|
# Run the server
|
|
CMD ["/app/rezervator", "-c /app/target/site/data/config.toml"] |