Dockerfile 875 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # This Dockerfile uses `serve` npm package to serve the static files with node process.
  2. # You can find the Dockerfile for nginx in the following link:
  3. # https://github.com/refinedev/dockerfiles/blob/main/vite/Dockerfile.nginx
  4. FROM refinedev/node:18 AS base
  5. FROM base as deps
  6. COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
  7. RUN \
  8. if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
  9. elif [ -f package-lock.json ]; then npm ci; \
  10. elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
  11. else echo "Lockfile not found." && exit 1; \
  12. fi
  13. FROM base as builder
  14. ENV NODE_ENV production
  15. COPY --from=deps /app/refine/node_modules ./node_modules
  16. COPY . .
  17. RUN npm run build
  18. FROM base as runner
  19. ENV NODE_ENV production
  20. RUN npm install -g serve
  21. COPY --from=builder /app/refine/dist ./
  22. USER refine
  23. CMD ["serve"]