Skip to content

Commit f375437

Browse files
committed
docker improvement
1 parent 62c992f commit f375437

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

api.Dockerfile

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,29 @@
11
# Build stage
2-
FROM oven/bun:1.2.20-slim AS builder
2+
FROM oven/bun:1.3.2-slim AS builder
33

44
WORKDIR /app
55

6-
# Copy dependency files
76
COPY package.json bun.lock turbo.json ./
8-
COPY apps/api/package.json ./apps/api/
7+
8+
COPY apps/ ./apps/
99
COPY packages/ ./packages/
1010

11-
# Install dependencies
12-
RUN bun install
11+
RUN bun install --production
1312

14-
# Copy source code
15-
COPY apps/api/ ./apps/api/
13+
RUN bunx turbo build --filter=@databuddy/api...
1614

17-
FROM oven/bun:1.2.20-slim
15+
FROM oven/bun:1.3.2-slim
1816

1917
WORKDIR /app
2018

21-
# Copy built files from builder
19+
COPY --from=builder /app/package.json ./
2220
COPY --from=builder /app/node_modules ./node_modules
2321
COPY --from=builder /app/apps/api ./apps/api
2422
COPY --from=builder /app/packages ./packages
2523

26-
# Set environment variables
27-
ENV NODE_ENV=production \
28-
PORT=4000 \
29-
BUN_ENV=production
3024

31-
# Expose port
3225
EXPOSE 4000
33-
# Start API
26+
3427
WORKDIR /app/apps/api
28+
3529
CMD ["bun", "run", "src/index.ts"]

0 commit comments

Comments
 (0)