-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (34 loc) · 1.31 KB
/
Dockerfile
File metadata and controls
49 lines (34 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# syntax=docker/dockerfile:1.7
FROM node:24-bookworm-slim AS frontend
WORKDIR /app/frontend
RUN corepack enable
COPY frontend/package.json frontend/pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
pnpm install --frozen-lockfile
COPY frontend ./
RUN pnpm build
FROM rust:1-bookworm AS backend
WORKDIR /app
RUN apt-get update && \
apt-get install -y --no-install-recommends libsqlite3-dev pkg-config && \
rm -rf /var/lib/apt/lists/*
COPY Cargo.toml Cargo.lock ./
COPY migrations ./migrations
COPY src ./src
COPY --from=frontend /app/frontend/dist ./frontend/dist
RUN --mount=type=cache,id=cargo-registry,target=/usr/local/cargo/registry \
--mount=type=cache,id=cargo-git,target=/usr/local/cargo/git \
--mount=type=cache,id=tokenaltar-target,target=/app/target \
cargo build --release && \
cp /app/target/release/tokenaltar /usr/local/bin/tokenaltar
FROM debian:bookworm-slim AS runtime
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates libsqlite3-0 && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=backend /usr/local/bin/tokenaltar /usr/local/bin/tokenaltar
ENV TOKENALTAR_BIND=0.0.0.0:8080
ENV TOKENALTAR_DATABASE_URL=sqlite:///data/tokenaltar.sqlite3
VOLUME ["/data"]
EXPOSE 8080
CMD ["tokenaltar"]