build: dockerize app, migrate on boot

This commit is contained in:
2026-06-04 00:07:55 +03:00
parent 91932d38ce
commit f8c56623a4
5 changed files with 83 additions and 2 deletions

27
Dockerfile Normal file
View 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"]