sqlx
This commit is contained in:
49
Dockerfile
Normal file
49
Dockerfile
Normal file
@@ -0,0 +1,49 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# ---- Frontend build (Vite + React, pnpm) ----
|
||||
FROM node:20-alpine AS frontend-build
|
||||
WORKDIR /app/frontend
|
||||
|
||||
# Enable pnpm via Corepack
|
||||
RUN corepack enable
|
||||
|
||||
# Install deps (cache-friendly)
|
||||
COPY frontend/package.json frontend/pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Build
|
||||
COPY frontend/ ./
|
||||
RUN pnpm build
|
||||
|
||||
# ---- Backend build (Rust + Actix) ----
|
||||
FROM rust:1.92-bookworm AS backend-build
|
||||
WORKDIR /app
|
||||
|
||||
# Cache Rust deps
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY src ./src
|
||||
COPY scp_core ./scp_core
|
||||
|
||||
# If you have a workspace / extra crates, copy them too (adjust):
|
||||
# COPY crates ./crates
|
||||
|
||||
RUN cargo build --release
|
||||
|
||||
# ---- Runtime image ----
|
||||
FROM debian:bookworm-slim AS runtime
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Adjust binary name
|
||||
COPY --from=backend-build /app/target/release/myapp /app/myapp
|
||||
|
||||
# Match your Actix static path: ./frontend/dist
|
||||
COPY --from=frontend-build /app/frontend/dist /app/frontend/dist
|
||||
|
||||
ENV RUST_LOG=info
|
||||
ENV HOST=0.0.0.0
|
||||
EXPOSE 8080
|
||||
CMD ["/app/myapp"]
|
||||
Reference in New Issue
Block a user