Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (39 loc) 路 1.51 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (39 loc) 路 1.51 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
# ================= INSTALL BUN ===================
ARG BUN_VERSION=1.3.9
FROM oven/bun:${BUN_VERSION}-slim AS bun
FROM node:24-bullseye-slim AS base
COPY --from=bun /usr/local/bin/bun /usr/local/bin/bun
RUN ln -s /usr/local/bin/bun /usr/local/bin/bunx
RUN apt-get update -qq \
&& apt-get install -qq --no-install-recommends \
build-essential \
ca-certificates \
git \
g++ \
openssl \
python3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# =============== INSTALL & BUILD =================
FROM base AS builder
ARG SCOPE
COPY . .
RUN SENTRYCLI_SKIP_DOWNLOAD=1 bun install --frozen-lockfile
RUN SKIP_ENV_CHECK=true DATABASE_URL=postgresql:// NEXT_PUBLIC_VIEWER_URL=http://localhost bunx nx build ${SCOPE}
RUN DATABASE_URL=postgresql:// bunx nx db:generate prisma
# ================== RELEASE ======================
FROM base AS release
ARG SCOPE
ENV SCOPE=${SCOPE}
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/packages/prisma/postgresql ./packages/prisma/postgresql
COPY --from=builder /app/packages/prisma/prisma.config.ts ./packages/prisma/prisma.config.ts
COPY --from=builder --chown=node:node /app/apps/${SCOPE}/.next/standalone ./
COPY --from=builder --chown=node:node /app/apps/${SCOPE}/.next/static ./apps/${SCOPE}/.next/static
COPY --from=builder --chown=node:node /app/apps/${SCOPE}/public ./apps/${SCOPE}/public
COPY scripts/${SCOPE}-entrypoint.sh ./
RUN chmod +x ./${SCOPE}-entrypoint.sh
USER node
ENTRYPOINT ./${SCOPE}-entrypoint.sh
EXPOSE 3000
ENV PORT=3000