-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (47 loc) · 2 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (47 loc) · 2 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
50
51
52
53
54
55
# syntax=docker/dockerfile:1.7
FROM oven/bun:1.3.14-alpine AS install
WORKDIR /app
COPY package.json bun.lock ./
RUN --mount=type=cache,target=/root/.bun/install/cache \
bun install --frozen-lockfile --ignore-scripts
FROM install AS build
COPY tsconfig.json ./
COPY src ./src
COPY fixtures ./fixtures
COPY web ./web
COPY deploy ./deploy
COPY scripts ./scripts
COPY skills ./skills
COPY LICENSE NOTICE ./
COPY LICENSES ./LICENSES
RUN bun run build
FROM install AS production-dependencies
RUN --mount=type=cache,target=/root/.bun/install/cache \
bun install --frozen-lockfile --production --ignore-scripts
FROM oven/bun:1.3.14-alpine AS runtime
ARG APP_UID=10001
ARG APP_GID=10001
ENV NODE_ENV=production \
PRISMLOOM_ENV=production \
PRISMLOOM_DATA_ROOT=/var/lib/prismloom \
PRISMLOOM_DATABASE_PATH=/var/lib/prismloom/prismloom.sqlite \
PRISMLOOM_TMP_DIR=/tmp/prismloom
RUN addgroup -S -g "${APP_GID}" prismloom \
&& adduser -S -D -H -u "${APP_UID}" -G prismloom prismloom \
&& install -d -m 0700 -o prismloom -g prismloom /var/lib/prismloom /tmp/prismloom
WORKDIR /app
COPY --from=production-dependencies --chown=prismloom:prismloom /app/node_modules ./node_modules
COPY --from=install --chown=prismloom:prismloom /app/package.json ./
COPY --from=build --chown=prismloom:prismloom /app/src ./src
COPY --from=build --chown=prismloom:prismloom /app/fixtures ./fixtures
COPY --from=build --chown=prismloom:prismloom /app/deploy ./deploy
COPY --from=build --chown=prismloom:prismloom /app/dist/web ./dist/web
COPY --from=build --chown=prismloom:prismloom /app/skills ./skills
COPY --from=build --chown=prismloom:prismloom /app/LICENSE /app/NOTICE ./
COPY --from=build --chown=prismloom:prismloom /app/LICENSES ./LICENSES
USER prismloom:prismloom
EXPOSE 3000
VOLUME ["/var/lib/prismloom"]
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD ["bun", "-e", "const response = await fetch('http://127.0.0.1:3000/readyz'); if (!response.ok) process.exit(1)"]
ENTRYPOINT ["bun", "deploy/main.ts"]