build: dockerize app, migrate on boot
This commit is contained in:
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
FROM node:22-alpine AS frontend-builder
|
||||
WORKDIR /frontend
|
||||
RUN npm install -g pnpm@10
|
||||
COPY frontend/package.json frontend/pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
COPY frontend/ ./
|
||||
RUN pnpm build
|
||||
|
||||
FROM rust:1-bookworm AS backend-builder
|
||||
WORKDIR /backend
|
||||
ENV SQLX_OFFLINE=true
|
||||
COPY backend/ ./
|
||||
RUN cargo build --release
|
||||
|
||||
FROM debian:12-slim AS runtime
|
||||
WORKDIR /app
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& mkdir -p /app/storage
|
||||
COPY --from=backend-builder /backend/target/release/backend /app/backend
|
||||
COPY --from=frontend-builder /frontend/build /app/static
|
||||
ENV STORAGE_PATH=/app/storage
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["/app/backend"]
|
||||
Reference in New Issue
Block a user