Files
glimpse/Dockerfile
T

40 lines
711 B
Docker

# Build stage
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . ./
RUN npm run build
# Production stage
FROM node:22-alpine
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=80
ENV DATA_DIR=/app/data
# Install production dependencies
COPY package*.json ./
RUN npm install --omit=dev
# Copy backend server code
COPY server/ ./server/
# Copy built frontend assets
COPY --from=builder /app/dist ./dist
# Create persistent storage directories
RUN mkdir -p /app/data/uploads
EXPOSE 80
HEALTHCHECK --interval=15s --timeout=5s --start-period=5s --retries=3 \
CMD wget --quiet --tries=1 --spider http://127.0.0.1:80/api/health || exit 1
CMD ["node", "server/index.js"]