|
|
|
|
|
FROM oven/bun:1.3.9 AS base |
|
|
|
|
|
|
|
|
FROM base AS turbo-cli |
|
|
RUN bun add -g turbo |
|
|
|
|
|
|
|
|
FROM turbo-cli AS builder |
|
|
WORKDIR /app |
|
|
COPY . . |
|
|
RUN echo "unknown" > .git-commit-sha |
|
|
RUN turbo prune @midday/api --docker |
|
|
|
|
|
|
|
|
FROM base AS installer |
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
COPY --from=builder /app/out/json/ . |
|
|
COPY bunfig.toml . |
|
|
RUN bun install |
|
|
|
|
|
|
|
|
COPY --from=builder /app/out/full/ . |
|
|
|
|
|
|
|
|
RUN bunx turbo run build --filter=@midday/engine --only |
|
|
|
|
|
|
|
|
FROM oven/bun:1.3.9 AS runner |
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y python3 python3-pip curl adduser && \ |
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh && \ |
|
|
apt-get clean && rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
ENV NODE_ENV=production |
|
|
ENV PORT=7860 |
|
|
|
|
|
|
|
|
COPY --from=installer /app/node_modules ./node_modules |
|
|
COPY --from=installer /app/apps/api ./apps/api |
|
|
COPY --from=installer /app/apps/engine ./apps/engine |
|
|
COPY --from=installer /app/packages ./packages |
|
|
COPY --from=installer /app/package.json ./package.json |
|
|
|
|
|
|
|
|
COPY --from=builder /app/.git-commit-sha /tmp/git-sha.txt |
|
|
COPY --from=builder /app/scripts/docker-entrypoint.sh /app/entrypoint.sh |
|
|
RUN chmod +x /app/entrypoint.sh |
|
|
|
|
|
|
|
|
RUN adduser --disabled-password --gecos "" hfuser |
|
|
RUN chown -R hfuser:hfuser /app |
|
|
USER hfuser |
|
|
|
|
|
WORKDIR /app/apps/api |
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
ENTRYPOINT ["/app/entrypoint.sh"] |
|
|
CMD ["bun", "src/index.ts"] |
|
|
|