ci(docker): add Dockerfile

This commit is contained in:
thek4n 2026-04-07 03:25:36 +03:00
parent 17ae6a036e
commit 71c5915628
2 changed files with 51 additions and 0 deletions

8
.dockerignore Normal file
View File

@ -0,0 +1,8 @@
target/
.git/
.gitignore
Dockerfile
.dockerignore
README.md
.env
*.md

43
Dockerfile Normal file
View File

@ -0,0 +1,43 @@
FROM rust:1.94 AS chef
RUN cargo install --locked cargo-chef
WORKDIR /app
COPY Cargo.toml Cargo.lock .
RUN mkdir src && touch src/main.rs
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=chef /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY rust-toolchain.toml rust-toolchain.toml
RUN cargo fetch
COPY . .
RUN cargo build --release
FROM debian:bookworm-slim AS runtime
RUN useradd -m -s /bin/bash appuser
WORKDIR /app
COPY --from=builder /app/target/release/mdpreview /usr/local/bin/mdpreview
USER appuser
EXPOSE 8080
CMD ["mdpreview"]