feat: dockerfile improvements

This commit is contained in:
alphafetus committed 2025-05-24 15:53:03 -04:00
1 parent 39db7d80e3
commit 747df0e7e5
3 files changed
+23 -8

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
node_modules
target
.git
+11 -8
View File
@@ -1,25 +1,28 @@
FROM rust:1.86 AS builder FROM rust:1.86 AS builder
# Install node for tailwind capability # Install node for tailwind capability
RUN apt-get update -y && apt-get install -y --no-install-recommends clang libc6 nodejs npm RUN apt-get update -y && apt-get install -y --no-install-recommends clang libc6
RUN node -v
RUN npm -v
RUN wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz 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 tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
RUN cargo binstall cargo-leptos -y RUN cargo binstall cargo-leptos -y
RUN rustup target add wasm32-unknown-unknown RUN rustup target add wasm32-unknown-unknown
# Set up working directory
RUN mkdir -p /app RUN mkdir -p /app
WORKDIR /app WORKDIR /app
COPY . . COPY . .
RUN npm install tailwindcss @tailwindcss/cli # Setup fnm and build with leptos
RUN cargo binstall fnm -y \
RUN cargo leptos build --release -vv && fnm --version \
&& eval "$(fnm env)" \
&& fnm install 20 \
&& fnm use 20 \
&& node -v \
&& npm install tailwindcss @tailwindcss/cli \
&& cargo leptos build --release -vv
# Start second phase of build - install ca-certs and copy all build outputs from previous step into a # Start second phase of build - install ca-certs and copy all build outputs from previous step into a
# Debian image in the /app directory. # Debian image in the /app directory.
+9
View File
@@ -0,0 +1,9 @@
services:
leptos-watch:
image: rust:1.86
ports:
- '3000:3000'
volumes:
- .:/app
command: cargo leptos watch