mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
42 lines
1.3 KiB
Docker
42 lines
1.3 KiB
Docker
# syntax=docker/dockerfile:1
|
|
FROM --platform=$BUILDPLATFORM oven/bun:1 AS builder
|
|
|
|
WORKDIR /build
|
|
|
|
# Set up workspace structure so bun can resolve workspace deps (@memoh/config, @memoh/agent)
|
|
COPY apps/agent/package.json apps/agent/bun.lock* ./apps/agent/
|
|
COPY packages/config/package.json ./packages/config/package.json
|
|
COPY packages/agent/package.json ./packages/agent/package.json
|
|
|
|
# Create root package.json with workspace config
|
|
RUN echo '{"name":"@memoh/monorepo","private":true,"workspaces":["apps/*","packages/*"]}' > package.json
|
|
|
|
RUN cd apps/agent && bun install
|
|
|
|
# Copy source files
|
|
COPY packages/config/ ./packages/config/
|
|
COPY packages/agent/ ./packages/agent/
|
|
COPY apps/agent/ ./apps/agent/
|
|
|
|
RUN cd apps/agent && bun run build
|
|
|
|
FROM oven/bun:1-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apk add --no-cache ca-certificates wget
|
|
|
|
COPY --from=builder /build/apps/agent/dist /app/dist
|
|
COPY --from=builder /build/apps/agent/node_modules /app/node_modules
|
|
COPY --from=builder /build/apps/agent/package.json /app/package.json
|
|
COPY --from=builder /build/node_modules /node_modules
|
|
|
|
EXPOSE 8081
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:8081/health \
|
|
|| wget --no-verbose --tries=1 --spider http://agent:8081/health \
|
|
|| exit 1
|
|
|
|
CMD ["bun", "run", "dist/index.js"]
|