feat: initial commit - Rust + React URL shortener
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
# Build frontend
|
||||
FROM node:20-alpine AS frontend-build
|
||||
WORKDIR /app
|
||||
COPY frontend/package.json frontend/package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY frontend/ .
|
||||
RUN npm run build
|
||||
|
||||
# Build Rust backend
|
||||
FROM rust:1.75 AS rust-builder
|
||||
WORKDIR /app
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY src/ ./src/
|
||||
RUN cargo build --release
|
||||
RUN cp target/release/hello-web /app/hello-web
|
||||
|
||||
# Final image
|
||||
FROM debian:bookworm-slim
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /app
|
||||
COPY --from=rust-builder /app/hello-web /app/hello-web
|
||||
COPY --from=frontend-build /app/dist /app/frontend/dist
|
||||
EXPOSE 3000
|
||||
CMD ["/app/hello-web"]
|
||||
Reference in New Issue
Block a user