Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Dockerfile 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # base image
  2. FROM node:22-alpine3.21 AS base
  3. LABEL maintainer="takatost@gmail.com"
  4. # if you located in China, you can use aliyun mirror to speed up
  5. # RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
  6. # if you located in China, you can use taobao registry to speed up
  7. # RUN npm config set registry https://registry.npmmirror.com
  8. RUN apk add --no-cache tzdata
  9. RUN corepack enable
  10. ENV PNPM_HOME="/pnpm"
  11. ENV PATH="$PNPM_HOME:$PATH"
  12. ENV NEXT_PUBLIC_BASE_PATH=
  13. # install packages
  14. FROM base AS packages
  15. WORKDIR /app/web
  16. COPY package.json .
  17. COPY pnpm-lock.yaml .
  18. # Use packageManager from package.json
  19. RUN corepack install
  20. RUN pnpm install --frozen-lockfile
  21. # build resources
  22. FROM base AS builder
  23. WORKDIR /app/web
  24. COPY --from=packages /app/web/ .
  25. COPY . .
  26. ENV NODE_OPTIONS="--max-old-space-size=4096"
  27. RUN pnpm build:docker
  28. # production stage
  29. FROM base AS production
  30. ENV NODE_ENV=production
  31. ENV EDITION=SELF_HOSTED
  32. ENV DEPLOY_ENV=PRODUCTION
  33. ENV CONSOLE_API_URL=http://127.0.0.1:5001
  34. ENV APP_API_URL=http://127.0.0.1:5001
  35. ENV MARKETPLACE_API_URL=https://marketplace.dify.ai
  36. ENV MARKETPLACE_URL=https://marketplace.dify.ai
  37. ENV PORT=3000
  38. ENV NEXT_TELEMETRY_DISABLED=1
  39. ENV PM2_INSTANCES=2
  40. # set timezone
  41. ENV TZ=UTC
  42. RUN ln -s /usr/share/zoneinfo/${TZ} /etc/localtime \
  43. && echo ${TZ} > /etc/timezone
  44. WORKDIR /app/web
  45. COPY --from=builder /app/web/public ./public
  46. COPY --from=builder /app/web/.next/standalone ./
  47. COPY --from=builder /app/web/.next/static ./.next/static
  48. COPY docker/entrypoint.sh ./entrypoint.sh
  49. # global runtime packages
  50. RUN pnpm add -g pm2 \
  51. && mkdir /.pm2 \
  52. && chown -R 1001:0 /.pm2 /app/web \
  53. && chmod -R g=u /.pm2 /app/web
  54. ARG COMMIT_SHA
  55. ENV COMMIT_SHA=${COMMIT_SHA}
  56. USER 1001
  57. EXPOSE 3000
  58. ENTRYPOINT ["/bin/sh", "./entrypoint.sh"]