-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.api
More file actions
31 lines (25 loc) · 908 Bytes
/
Copy pathDockerfile.api
File metadata and controls
31 lines (25 loc) · 908 Bytes
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
# Stage 1: Build stage
FROM oven/bun:1.2-alpine AS builder
WORKDIR /app
COPY . .
RUN bun install --dev --no-cache
# Build types first (required dependency for api)
RUN cd packages/types && bun run build
# Then build api
RUN bun run build:api
# Stage 2: Runtime stage
FROM oven/bun:1.2-alpine
WORKDIR /app
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S bunuser -u 1001
# Copy the API dist files
COPY --from=builder /app/packages/api/dist ./dist
# Copy node_modules first (includes symlinks)
COPY --from=builder /app/node_modules ./node_modules
# Copy the types package to overwrite the symlink with actual files
COPY --from=builder /app/packages/types/dist ./node_modules/@agglayer/bridge-hub-types/dist
COPY --from=builder /app/packages/types/package.json ./node_modules/@agglayer/bridge-hub-types/package.json
USER bunuser
EXPOSE 3001
CMD ["bun", "run", "dist/server.js"]