-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.chase.frontend
43 lines (38 loc) · 1.73 KB
/
Dockerfile.chase.frontend
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
FROM oven/bun:latest AS install
COPY package.json bun.lockb /temp/dev/
COPY chase/backend/package.json /temp/dev/chase/backend/package.json
COPY chase/frontend/package.json /temp/dev/chase/frontend/package.json
RUN cd /temp/dev && bun install --frozen-lockfile
# we need to use node and bun for generating prisma files, see https://github.com/prisma/prisma/issues/21241
FROM imbios/bun-node AS builder
WORKDIR /app/staging
COPY --from=install /temp/dev/node_modules node_modules
COPY chase/frontend chase/frontend/
COPY chase/backend chase/backend/
# generates types and runs a typecheck for the backend since the frontend is using those types
RUN cd chase/backend && bun run typecheck
RUN bun next telemetry disable
RUN cd chase/frontend && bun run build
# unfortunately we need a nextjs installation at runtime
FROM oven/bun:latest AS nextjs
WORKDIR /app/staging
COPY package.json bun.lockb /app/staging/
COPY chase/backend/package.json /app/staging/chase/backend/package.json
COPY chase/frontend/package.json /app/staging/chase/frontend/package.json
RUN cd /app/staging/chase/frontend && bun install next
FROM oven/bun:latest AS release
WORKDIR /app/prod
COPY --from=nextjs /app/staging/node_modules ./node_modules/
COPY --from=builder /app/staging/chase/frontend/public ./public/
# Copy the entire standalone directory
COPY --from=builder /app/staging/chase/frontend/.next/standalone ./
COPY --from=builder /app/staging/chase/frontend/.next/static ./.next/static
# Add this line to copy required server files
COPY --from=builder /app/staging/chase/frontend/.next/server ./.next/server
ARG NEXT_PUBLIC_VERSION
ENV NODE_ENV=production
ENV PORT=3000
ENV NEXT_PUBLIC_VERSION=${NEXT_PUBLIC_VERSION}
USER bun
EXPOSE 3000/tcp
ENTRYPOINT [ "bunx", "next", "start" ]