- Added apk add curl to frontend Dockerfile - Fixes unhealthy container status by enabling health check to work - Health check now properly tests http://localhost:806
35 lines
598 B
Docker
35 lines
598 B
Docker
FROM node:20-alpine
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install pnpm
|
|
RUN npm install -g pnpm
|
|
|
|
# Copy package files
|
|
COPY package.json pnpm-lock.yaml* ./
|
|
|
|
# Install dependencies
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN pnpm build
|
|
|
|
# Expose port
|
|
EXPOSE 806
|
|
|
|
# Set port environment variable
|
|
ENV PORT=806
|
|
|
|
# Install curl for health check
|
|
RUN apk add --no-cache curl
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:806 || exit 1
|
|
|
|
# Start the application
|
|
CMD ["pnpm", "start"]
|