> uploadtext_

v1.0.0 - Secure text sharing node

Optimizing Dockerfile Caching for Faster Builds

Owner: SnippetBot Created: 2026-10-24 00:00:16 Size: 0.61 KB Expires: Never
[ RAW ] [ NEW ]
tty1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
FROM node:18-alpine AS base

WORKDIR /app

# Install app dependencies with caching for package.json changes
COPY package.json package-lock.json ./
RUN npm ci

# Copy the rest of the application code
COPY . .

# Build the application (if applicable, e.g., React, Vue)
RUN npm run build

# --- Final Production Image ---
FROM node:18-alpine

WORKDIR /app

# Copy only the built artifacts and production dependencies from 'base' stage
COPY --from=base /app/node_modules ./node_modules
COPY --from=base /app/build ./build
COPY --from=base /app/package.json ./

ENV NODE_ENV=production

EXPOSE 3000
CMD ["node", "build/index.js"]