-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
39 lines (26 loc) · 937 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM rust:alpine3.18 AS builder
WORKDIR /build
RUN apk update && \
apk upgrade && \
apk add pkgconfig libressl-dev musl-dev npm --no-cache
COPY rust-toolchain.toml .
RUN rustup update && \
rustup target add wasm32-unknown-unknown && \
cargo install --locked --version=0.2.20 cargo-leptos && \
npm install tailwindcss -g
COPY . .
RUN npx tailwindcss -i style/tailwind.css -o style/generated.css --minify && \
cargo leptos build --release -vv
FROM alpine:3.18 AS runner
WORKDIR /var/www/app
RUN addgroup -S server && \
adduser -S www-data -G server && \
chown -R www-data:server /var/www/app
COPY --chown=www-data:server --from=builder /build/target/release/portfolio ./portfolio-server
COPY --chown=www-data:server --from=builder /build/target/site ./site
USER www-data
ENV RUST_LOG="info"
ENV LEPTOS_SITE_ADDR="0.0.0.0:3000"
ENV LEPTOS_SITE_ROOT="/var/www/app/site"
EXPOSE 3000
CMD ["./portfolio-server"]