esbuild for prod
This commit is contained in:
parent
7e7f6e3b99
commit
1cb1c1a333
4 changed files with 27 additions and 9 deletions
12
Dockerfile
12
Dockerfile
|
|
@ -4,9 +4,10 @@ FROM node:18-alpine
|
|||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files and install dependencies
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --only=production
|
||||
# Copy package files, config script, and install dependencies
|
||||
COPY package.json package-lock.json esbuild.config.js ./
|
||||
# Install all dependencies, build with esbuild, then remove devDeps
|
||||
RUN npm ci && npm run build && npm prune --production
|
||||
|
||||
# Copy application source
|
||||
COPY . .
|
||||
|
|
@ -14,5 +15,8 @@ COPY . .
|
|||
# Expose the application port
|
||||
EXPOSE 3000
|
||||
|
||||
# Set NODE_ENV to production
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Run the application
|
||||
CMD ["npm", "start"]
|
||||
CMD ["npm", "run", "daemon"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue