repos
/ finance-rust master

finance-rust

mirror archived upstream

Single-binary self-hosted market watcher for stocks, ETFs, indexes, and futures: live charts, key stats, fundamentals, SEC filings, and SSE streaming.

axumdockerfinancerustself-hostedsqlitestocksvite

1.2 KB · 50 lines · Docker Raw History
 1# syntax=docker/dockerfile:1
 2# ----- builder -----
 3FROM rust:alpine AS builder
 4
 5RUN apk add --no-cache musl-dev pkgconfig openssl-dev
 6
 7COPY --from=oven/bun:alpine /usr/local/bin/bun /usr/local/bin/bun
 8
 9WORKDIR /app
10
11COPY Cargo.toml Cargo.lock ./
12COPY src ./src
13COPY migrations ./migrations
14COPY frontend ./frontend
15# Needed at COMPILE time: src/sp500.rs embeds universe/sp500.txt via include_str!
16# (the runtime stage also copies universe/ for starter.csv, read at runtime).
17COPY universe ./universe
18
19RUN cd frontend && bun install --frozen-lockfile && bun run build
20
21RUN --mount=type=cache,target=/usr/local/cargo/registry \
22    --mount=type=cache,target=/app/target \
23    cargo build --release && \
24    cp target/release/finance /app/finance
25
26# ----- runtime -----
27FROM alpine:3.23
28
29# Outbound HTTPS to Yahoo and SEC EDGAR.
30RUN apk add --no-cache ca-certificates
31
32WORKDIR /app
33
34COPY --from=builder /app/finance ./finance
35COPY --from=builder /app/dist ./dist
36COPY templates ./templates
37COPY migrations ./migrations
38COPY universe ./universe
39
40RUN addgroup -S -g 1000 app && \
41    adduser -S -h /app -s /sbin/nologin -u 1000 -G app app && \
42    mkdir -p /data && chown -R app:app /app /data
43USER app
44
45ENV PORT=8000
46ENV FINANCE_DATA_DIR=/data
47EXPOSE 8000
48
49CMD ["./finance"]