mike-marcacci-node-redlock
SUCCESS
21m 32s
History Source
SummaryIterations1Transcript22Dockerfile
Dockerfile23 lines · 667 chars
FROM node:18 AS builder
WORKDIR /workspace

# Install dependencies without running prepare scripts to avoid yarn build during npm install
COPY package.json ./
RUN npm install --ignore-scripts --silent

# Copy the project files and build from source
COPY . .
RUN npm run build

FROM node:18 AS runtime
WORKDIR /workspace

# Copy built artifacts and dependencies from builder
COPY --from=builder /workspace/dist ./dist
COPY --from=builder /workspace/node_modules ./node_modules
COPY --from=builder /workspace/package.json ./package.json
ENV NODE_ENV=production

# Start the built library (or a simple loader) to verify container works
CMD ["node", "dist/esm/index.js"]