- Split Dockerfile into multi-stage build to reduce final image size - Update docker-compose.yml with restart policies and health checks - Improve .dockerignore files for both frontend and backend - Fix MinIO bucket creation script to use 'alias set' instead of deprecated command - Enhance PostgreSQL healthcheck configuration
40 lines
843 B
Docker
40 lines
843 B
Docker
# --- Stage 1: Build ---
|
|
FROM node:20-slim AS builder
|
|
|
|
ARG RELEASE_VERSION
|
|
RUN apt-get update && apt-get install -y \
|
|
python3 \
|
|
make \
|
|
g++ \
|
|
curl \
|
|
postgresql-server-dev-all \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
RUN echo "$RELEASE_VERSION" > release
|
|
|
|
# --- Stage 2: Production Image ---
|
|
FROM node:20-slim
|
|
|
|
RUN apt-get update && apt-get install -y libpq5 && rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /usr/src/app/package*.json ./
|
|
COPY --from=builder /usr/src/app/build ./build
|
|
COPY --from=builder /usr/src/app/node_modules ./node_modules
|
|
COPY --from=builder /usr/src/app/release ./release
|
|
COPY --from=builder /usr/src/app/worklenz-email-templates ./worklenz-email-templates
|
|
|
|
|
|
EXPOSE 3000
|
|
CMD ["node", "build/bin/www"]
|
|
|