this repo has no description
1# -- Stage 1: Build frontend --
2FROM node:22-alpine AS web-build
3
4WORKDIR /app
5
6COPY web/package.json web/package-lock.json ./
7RUN npm ci
8
9COPY web/ .
10COPY content/ ../content/
11RUN npm run build
12
13# -- Stage 2: Build server --
14FROM rust:1-alpine AS server-build
15
16RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static pkgconfig
17
18WORKDIR /app
19
20# Cache dependencies: copy manifests first, build a dummy, then swap in real source
21COPY api/Cargo.toml api/Cargo.lock ./
22RUN mkdir src && echo 'fn main() {}' > src/main.rs && cargo build --release && rm -rf src target/release/deps/ayos*
23
24COPY api/src ./src
25COPY api/migrations ./migrations
26RUN cargo build --release
27
28# -- Stage 3: Runtime --
29FROM alpine:3.21
30
31RUN apk add --no-cache ca-certificates
32
33WORKDIR /app
34
35COPY --from=server-build /app/target/release/ayos-api ./server
36COPY --from=web-build /app/dist ./dist
37
38VOLUME /app/data
39
40ENV DATABASE_URL=sqlite:/app/data/ayos.db
41ENV JWT_SECRET=change-me-in-production
42ENV STATIC_DIR=/app/dist
43ENV PORT=3000
44
45EXPOSE 3000
46
47CMD ["./server"]