mirror of
https://github.com/kristoferssolo/cipher-workshop.git
synced 2025-12-20 11:04:38 +00:00
feat(web): add Dockerfile
This commit is contained in:
parent
bb7ef246f8
commit
ce3a09088f
27
.dockerignore
Normal file
27
.dockerignore
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Rust
|
||||||
|
target/
|
||||||
|
Cargo.lock
|
||||||
|
*.rlib
|
||||||
|
*.rmeta
|
||||||
|
|
||||||
|
# Node/npm
|
||||||
|
node_modules/
|
||||||
|
package-lock.json
|
||||||
|
npm-debug.log
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Git
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
|
||||||
|
# General
|
||||||
|
*.log
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
3
.env
Normal file
3
.env
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
RUST_LOG=info
|
||||||
|
LEPTOS_SITE_ADDR=0.0.0.0:8080
|
||||||
|
LEPTOS_SITE_ROOT=site
|
||||||
34
Cargo.toml
34
Cargo.toml
@ -8,34 +8,28 @@ authors = ["Kristofers Solo <dev@kristofers.xyz>"]
|
|||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
|
aes = { path = "aes" }
|
||||||
|
cipher-core = { path = "cipher-core" }
|
||||||
|
cipher-factory = { path = "cipher-factory" }
|
||||||
claims = "0.8"
|
claims = "0.8"
|
||||||
|
clap = { version = "4.5", features = ["derive"] }
|
||||||
color-eyre = "0.6"
|
color-eyre = "0.6"
|
||||||
|
des = { path = "des" }
|
||||||
rand = "0.9"
|
rand = "0.9"
|
||||||
rstest = "0.26"
|
rstest = "0.26"
|
||||||
strum = "0.27"
|
strum = "0.27"
|
||||||
thiserror = "2"
|
thiserror = "2"
|
||||||
|
zeroize = { version = "1.8", features = ["derive"] }
|
||||||
[workspace.dependencies.aes]
|
|
||||||
path = "aes"
|
|
||||||
|
|
||||||
[workspace.dependencies.cipher-core]
|
|
||||||
path = "cipher-core"
|
|
||||||
|
|
||||||
[workspace.dependencies.cipher-factory]
|
|
||||||
path = "cipher-factory"
|
|
||||||
|
|
||||||
[workspace.dependencies.clap]
|
|
||||||
version = "4.5"
|
|
||||||
features = ["derive"]
|
|
||||||
|
|
||||||
[workspace.dependencies.des]
|
|
||||||
path = "des"
|
|
||||||
|
|
||||||
[workspace.dependencies.zeroize]
|
|
||||||
version = "1.8"
|
|
||||||
features = ["derive"]
|
|
||||||
|
|
||||||
[workspace.lints.clippy]
|
[workspace.lints.clippy]
|
||||||
nursery = "warn"
|
nursery = "warn"
|
||||||
pedantic = "warn"
|
pedantic = "warn"
|
||||||
unwarp_used = "warn"
|
unwarp_used = "warn"
|
||||||
|
|
||||||
|
# Defines a size-optimized profile for the WASM bundle in release mode
|
||||||
|
[profile.wasm-release]
|
||||||
|
inherits = "release"
|
||||||
|
opt-level = 'z'
|
||||||
|
lto = true
|
||||||
|
codegen-units = 1
|
||||||
|
panic = "abort"
|
||||||
|
|||||||
48
Dockerfile
Normal file
48
Dockerfile
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
|
|
||||||
|
FROM rustlang/rust:nightly-bookworm AS cacher
|
||||||
|
|
||||||
|
RUN curl -LO 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
|
||||||
|
RUN cargo binstall cargo-leptos cargo-chef -y
|
||||||
|
RUN apt-get update -y && apt-get install -y --no-install-recommends clang
|
||||||
|
RUN rustup target add wasm32-unknown-unknown
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=chef /app/recipe.json recipe.json
|
||||||
|
RUN cargo chef cook --release --recipe-path recipe.json
|
||||||
|
|
||||||
|
FROM rustlang/rust:nightly-bookworm AS builder
|
||||||
|
|
||||||
|
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
|
||||||
|
RUN cargo binstall cargo-leptos -y
|
||||||
|
RUN apt-get update -y && apt-get install -y --no-install-recommends clang
|
||||||
|
RUN rustup target add wasm32-unknown-unknown
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=cacher /app/target target
|
||||||
|
COPY . .
|
||||||
|
RUN cargo leptos build --release -vv
|
||||||
|
|
||||||
|
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 --from=builder /app/target/release/web /app/
|
||||||
|
COPY --from=builder /app/target/site /app/site
|
||||||
|
COPY --from=builder /app/Cargo.toml /app/
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
CMD ["/app/web"]
|
||||||
9
docker-compose.yml
Normal file
9
docker-compose.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
services:
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
env_file: .env
|
||||||
|
restart: unless-stopped
|
||||||
Loading…
Reference in New Issue
Block a user