asset-service/Dockerfile

45 lines
876 B
Docker

# Asset Service Docker Image
# Serves static images from bigdisk storage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package.json ./
COPY .npmrc ./
# Install dependencies
RUN npm install
# Copy source
COPY tsconfig.json ./
COPY src/ ./src/
# Build
RUN npm run build
# Production image
FROM node:20-alpine
WORKDIR /app
# Copy built files and production dependencies
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY package.json ./
# Environment variables
ENV NODE_ENV=production
ENV PORT=3800
ENV BIGDISK_PATH=/mnt/bigdisk/_/lilith-platform/features
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3800/health || exit 1
# Expose port
EXPOSE 3800
# Start server
CMD ["node", "dist/server.js"]