-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
46 lines (30 loc) · 1.02 KB
/
Dockerfile
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
# Stage 1: Install dependencies for the entire monorepo
FROM oven/bun:latest AS dependencies
WORKDIR /app
# Copy the entire monorepo
COPY . .
# Install dependencies for the entire workspace using Bun
RUN bun install
# Stage 2: Build the client
FROM dependencies AS client-build
WORKDIR /app/apps/client
# Build the client
RUN bun run build
# Stage 3: Build the server
FROM dependencies AS server-build
WORKDIR /app/apps/server
# Build the server binary
RUN bun build --compile --target=bun-linux-x64 ./index.ts --outfile server --minify
# Stage 4: Final runtime stage
FROM oven/bun:latest AS runtime
WORKDIR /app
# Copy the client `dist` folder from the client build stage
COPY --from=client-build /app/apps/client/dist ./dist
# Copy drizzle migration meta
COPY --from=server-build /app/apps/server/drizzle ./drizzle
# Copy the built server binary from the server build stage
COPY --from=server-build /app/apps/server/server ./server
# Expose the port for the server
EXPOSE 5000
# Run the compiled server binary
CMD ["./server"]