imkFinal/backend/_Dockerfile
2025-03-31 06:27:21 +02:00

43 lines
773 B
Plaintext

FROM node:18.19.1-alpine3.18
WORKDIR /usr/src/app
# Install necessary tools and dependencies
RUN apk add --no-cache \
curl \
wget \
python3 \
make \
g++ \
&& rm -rf /var/cache/apk/*
# Copy package files
COPY package*.json ./
COPY prisma ./prisma/
# Install dependencies
# RUN npm ci --only=production
# Generate Prisma client
RUN npx prisma generate
# Copy source code
COPY . .
# Build the application
RUN npm run build
# Expose port
EXPOSE 3000
# Add healthcheck
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget -q --spider http://localhost:3000/health || exit 1
# Set Node options
ENV NODE_OPTIONS="--max-old-space-size=2048"
# Start the application directly with node
CMD ["node", "dist/main.js"]