chore: first commit
This commit is contained in:
commit
4f811d88f2
30 changed files with 4301 additions and 0 deletions
54
Dockerfile
Normal file
54
Dockerfile
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
# ── Javascript ──────────────────────────────────────────────────────────
|
||||
|
||||
FROM docker.io/oven/bun:1 AS bun
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# install dependencies into temp directory
|
||||
# this will cache them and speed up future builds
|
||||
FROM bun AS js-deps
|
||||
COPY package.json bun.lock /temp/dev/
|
||||
RUN cd /temp/dev && bun install --frozen-lockfile
|
||||
|
||||
# ── Rust ────────────────────────────────────────────────────────────────
|
||||
|
||||
FROM rust:slim AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Create appuser in builder as the scratch image can't do it
|
||||
RUN adduser \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "/nonexistent" \
|
||||
--shell "/sbin/nologin" \
|
||||
--no-create-home \
|
||||
--uid 10001 \
|
||||
appuser
|
||||
|
||||
COPY . .
|
||||
COPY --from=js-deps /usr/local/bin/bun /usr/local/bin/bun
|
||||
COPY --from=js-deps /temp/dev/node_modules node_modules
|
||||
|
||||
RUN --mount=type=cache,target=/app/target/ \
|
||||
--mount=type=cache,target=/usr/local/cargo/git/db \
|
||||
--mount=type=cache,target=/usr/local/cargo/registry/ \
|
||||
cargo build --locked --release \
|
||||
&& mv target/release/compendium /tmp/compendium
|
||||
|
||||
FROM gcr.io/distroless/cc AS runner
|
||||
|
||||
COPY --from=builder /etc/passwd /etc/passwd
|
||||
COPY --from=builder /etc/group /etc/group
|
||||
|
||||
ENV RUST_LOG="compendium=debug,info"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder --chown=appuser:appuser /tmp/compendium /app/compendium
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
USER appuser:appuser
|
||||
|
||||
CMD ["/app/compendium"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue