Dockerfile 627 B

1234567891011121314151617181920212223242526
  1. FROM node:20-alpine
  2. WORKDIR /app
  3. # Set apk mirror and install build tools for native modules
  4. RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
  5. apk add --no-cache python3 make g++ imagemagick poppler-utils ghostscript
  6. # Copy package files
  7. COPY package*.json yarn.lock* ./
  8. # Set yarn registry and install all dependencies (including dev for build)
  9. RUN yarn config set registry https://registry.npmmirror.com && \
  10. yarn install
  11. # Copy source code
  12. COPY . .
  13. # Build the application
  14. RUN yarn build
  15. # Expose port
  16. EXPOSE 3001
  17. # Start application
  18. CMD ["node", "/app/dist/src/main.js"]