32 lines
943 B
Docker
32 lines
943 B
Docker
FROM node:20-alpine AS javascript-builder
|
|
WORKDIR /app
|
|
|
|
# It's best to add as few files as possible before running the build commands
|
|
# as they will be re-run everytime one of those files changes.
|
|
#
|
|
# It's possible to run npm install with only the package.json and package-lock.json file.
|
|
|
|
ADD ./client/package.json ./client/package-lock.json ./
|
|
|
|
# Install git and other necessary build tools
|
|
RUN apk add --no-cache git
|
|
|
|
# Clear npm cache, remove existing node_modules, and install dependencies
|
|
RUN npm cache clean --force && \
|
|
rm -rf node_modules && \
|
|
npm ci
|
|
|
|
# Explicitly install the correct version of esbuild
|
|
# RUN npm install esbuild@0.21.5
|
|
|
|
ADD ./client/ /app/
|
|
# Increase Node memory limit to prevent out of memory error during build
|
|
RUN NODE_OPTIONS="--max-old-space-size=4096" npm run build
|
|
|
|
FROM node:20-alpine
|
|
WORKDIR /app
|
|
COPY --from=javascript-builder /app/.output/ /app/
|
|
RUN ls /app/
|
|
|
|
CMD [ "node", "./server/index.mjs" ]
|