ci: added basic workflows (#2)
Some checks failed
CI / Clippy (push) Successful in 2m35s
CI / Security Audit (push) Successful in 1m46s
CI / Tests (push) Successful in 3m5s
CI / Format (push) Successful in 6m53s
CI / Build & Push Image (push) Failing after 1m54s
CI / Changelog (push) Failing after 1m39s
Some checks failed
CI / Clippy (push) Successful in 2m35s
CI / Security Audit (push) Successful in 1m46s
CI / Tests (push) Successful in 3m5s
CI / Format (push) Successful in 6m53s
CI / Build & Push Image (push) Failing after 1m54s
CI / Changelog (push) Failing after 1m39s
Co-authored-by: Sharang Parnerkar <parnerkarsharang@gmail.com> Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
61
Dockerfile
Normal file
61
Dockerfile
Normal file
@@ -0,0 +1,61 @@
|
||||
# Stage 1: Generate dependency recipe for caching
|
||||
FROM rust:1.89-bookworm AS chef
|
||||
RUN cargo install cargo-chef
|
||||
WORKDIR /app
|
||||
|
||||
FROM chef AS planner
|
||||
COPY . .
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
# Stage 2: Build dependencies + application
|
||||
FROM chef AS builder
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
pkg-config libssl-dev curl unzip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install bun (for Tailwind CSS build step)
|
||||
RUN curl -fsSL https://bun.sh/install | bash
|
||||
ENV PATH="/root/.bun/bin:$PATH"
|
||||
|
||||
# Install dx CLI via cargo-binstall
|
||||
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 dioxus-cli@0.7.3 --root /.cargo -y --force
|
||||
ENV PATH="/.cargo/bin:$PATH"
|
||||
|
||||
# Cook dependencies from recipe (cached layer)
|
||||
COPY --from=planner /app/recipe.json recipe.json
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
|
||||
# Copy source and build
|
||||
COPY . .
|
||||
|
||||
# Ensure styles directory exists for build.rs tailwind step
|
||||
RUN mkdir -p styles && touch styles/input.css
|
||||
|
||||
# Bundle the fullstack application
|
||||
RUN dx bundle --platform fullstack
|
||||
|
||||
# Stage 3: Minimal runtime image
|
||||
FROM debian:bookworm-slim AS runtime
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates libssl3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN useradd --create-home --shell /bin/bash app
|
||||
USER app
|
||||
WORKDIR /home/app
|
||||
|
||||
# Copy the bundled output from builder
|
||||
COPY --from=builder --chown=app:app /app/target/dx/dashboard/release/web/ ./
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
ENV IP=0.0.0.0
|
||||
ENV PORT=8000
|
||||
|
||||
ENTRYPOINT ["./server"]
|
||||
Reference in New Issue
Block a user