Portfolio / Dockerfile
teganmosi
Initial commit of portfolio
4dd77d6
Raw
History Blame Contribute Delete
786 Bytes
# Build stage
FROM node:20-slim AS builder
WORKDIR /app
# Copy dependency manifests
COPY package*.json ./
# Install dependencies (including devDependencies for building)
RUN npm ci
# Copy application source
COPY . .
# Build production assets and bundle the TypeScript server
RUN npm run build
# Production runner stage
FROM node:20-slim AS runner
ENV NODE_ENV=production
ENV PORT=7860
WORKDIR /app
RUN chown node:node /app
# Run as non-root 'node' user (UID 1000) for security and Hugging Face compatibility
USER node
# Copy built application assets and manifests
COPY --chown=node:node --from=builder /app/package*.json ./
COPY --chown=node:node --from=builder /app/dist ./dist
# Install production dependencies only
RUN npm ci --omit=dev
EXPOSE 7860
CMD ["npm", "start"]