-
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathDockerfile
More file actions
85 lines (60 loc) · 2.19 KB
/
Copy pathDockerfile
File metadata and controls
85 lines (60 loc) · 2.19 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
ARG BUN_VERSION=1
FROM oven/bun:${BUN_VERSION} AS build
WORKDIR /app
COPY /scripts/run.ts ./scripts/run.ts
# Cache packages
COPY patches patches
COPY package.json package.json
COPY bun.lock bun.lock
COPY /packages/config/package.json ./packages/config/package.json
COPY /packages/libs/package.json ./packages/libs/package.json
COPY /apps/api/package.json ./apps/api/package.json
COPY /apps/web/package.json ./apps/web/package.json
COPY /apps/extension/package.json ./apps/extension/package.json
COPY /apps/app/package.json ./apps/app/package.json
COPY ./test/package.json ./test/package.json
RUN bun install --frozen-lockfile # or `bun ci` but at least it's explicit
COPY /resources/plannings/index.ts ./resources/plannings/index.ts
COPY /apps/api ./apps/api
COPY /apps/web ./apps/web
COPY /packages/config ./packages/config
COPY /packages/libs ./packages/libs
RUN bun run lint && bun run typecheck
ENV NODE_ENV=production
RUN bun run build
COPY /resources/plannings/ /tmp/plannings/
RUN mkdir -p ./plannings && \
cp /tmp/plannings/*.json ./plannings/
ENV PLANNINGS_LOCATION=/app/plannings
COPY /test ./test
ENV NODE_ENV=test
RUN bun run test:unit
COPY .git/HEAD /tmp/git/HEAD
COPY .git/refs /tmp/git/refs
RUN set -e; \
head=$(cat /tmp/git/HEAD); \
if echo "$head" | grep -q '^ref: '; then \
ref=$(echo "$head" | sed 's/^ref: //'); \
sha=$(cat "/tmp/git/$ref"); \
else \
sha="$head"; \
fi; \
printf '%.7s' "$sha" > /tmp/commit_sha
##########################################################
FROM cgr.dev/chainguard/glibc-dynamic:latest
WORKDIR /app
COPY --from=ghcr.io/tarampampam/microcheck:1 /bin/httpcheck /bin/httpcheck
ENV PLANNINGS_LOCATION=/app/plannings
ENV WEB_DIST_LOCATION=/app/web/dist
COPY /apps/api/drizzle.config.ts ./drizzle.config.ts
COPY /apps/api/drizzle ./drizzle
COPY --from=build /app/apps/api/server ./server
COPY --from=build /app/apps/web/dist ./web/dist/
COPY --from=build /app/plannings ./plannings
COPY --from=build /tmp/commit_sha ./commit_sha
ENV NODE_ENV=production
ENV PORT=20000
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
CMD ["/bin/httpcheck", "http://127.0.0.1:20000/api/ping"]
CMD ["./server"]
EXPOSE $PORT