29 lines
625 B
Docker
29 lines
625 B
Docker
# ScriptShare API Dockerfile
|
|
FROM node:18-alpine
|
|
|
|
# Install system dependencies for native modules
|
|
RUN apk add --no-cache python3 make g++ libc6-compat curl
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files first for better caching
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci --only=production=false
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build TypeScript
|
|
RUN npx tsc --build
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
|
CMD curl -f http://localhost:3000/api/health || exit 1
|
|
|
|
# Start the API server
|
|
CMD ["npm", "run", "start:api"] |