-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.bun
More file actions
48 lines (40 loc) · 1.28 KB
/
Dockerfile.bun
File metadata and controls
48 lines (40 loc) · 1.28 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
FROM oven/bun:1.2-slim AS base
FROM base AS dependencies
WORKDIR /build/dependencies
COPY package.json bun.lock tsconfig.json ./
RUN bun install --frozen-lockfile
FROM base AS runtime-dependencies
WORKDIR /build/dependencies
COPY package.json bun.lock tsconfig.json ./
RUN bun install --frozen-lockfile --production
FROM base AS builder
WORKDIR /build/staging
ARG VERSION
ENV PUBLIC_VERSION=$VERSION
ARG SHA
ENV PUBLIC_SHA=$SHA
COPY --from=dependencies /build/dependencies .
COPY --from=runtime-dependencies /build/dependencies .
COPY . .
# the build command generates a few things, such as i18n outputs
# therefore we need to run the build command BEFORE we check for correctness
RUN bun run build
RUN bun run check
FROM base AS release
WORKDIR /app/release
ARG VERSION
ENV PUBLIC_VERSION=$VERSION
ARG SHA
ENV PUBLIC_SHA=$SHA
COPY --from=builder /build/staging/build .
COPY ./drizzle ./drizzle/
COPY ./drizzle.config.ts .
COPY ./src/api/db/schema.ts ./src/api/db/schema.ts
COPY --from=runtime-dependencies /build/dependencies .
RUN chown -R bun:bun .
USER bun
ENV NODE_ENV=production
EXPOSE 3000/tcp
# TODO
# HEALTHCHECK --interval=15s --timeout=10s --retries=3 CMD curl -f http://0.0.0.0:3000/api/health/ready || exit 1
CMD ["sh", "-c", "./node_modules/.bin/drizzle-kit migrate && bun ./index.js"]