64 lines
1.6 KiB
Docker
64 lines
1.6 KiB
Docker
FROM node:24-alpine AS api-deps
|
|
WORKDIR /build/api
|
|
|
|
COPY api/package*.json ./
|
|
RUN npm ci
|
|
|
|
FROM node:24-alpine AS api-build
|
|
WORKDIR /build/api
|
|
|
|
COPY --from=api-deps /build/api/node_modules ./node_modules
|
|
COPY api/package*.json ./
|
|
COPY api/nest-cli.json api/tsconfig*.json ./
|
|
COPY api/src ./src
|
|
RUN npm run build
|
|
|
|
FROM node:24-alpine AS api-prod-deps
|
|
WORKDIR /build/api
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
COPY api/package*.json ./
|
|
RUN npm ci --omit=dev --ignore-scripts
|
|
|
|
FROM node:24-alpine AS client-deps
|
|
WORKDIR /build/client
|
|
|
|
COPY client/package*.json ./
|
|
RUN npm ci
|
|
|
|
FROM node:24-alpine AS client-build
|
|
WORKDIR /build/client
|
|
|
|
COPY --from=client-deps /build/client/node_modules ./node_modules
|
|
COPY client/package*.json ./
|
|
COPY client/angular.json client/tsconfig*.json ./
|
|
COPY client/public ./public
|
|
COPY client/src ./src
|
|
RUN npm run build
|
|
|
|
FROM node:24-alpine AS production
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
|
|
RUN apk add --no-cache nginx supervisor wget \
|
|
&& mkdir -p /run/nginx /var/log/supervisor /usr/share/nginx/html \
|
|
&& chown -R node:node /app
|
|
|
|
COPY --from=api-prod-deps /build/api/node_modules ./api/node_modules
|
|
COPY --from=api-build /build/api/dist ./api/dist
|
|
COPY api/package*.json ./api/
|
|
COPY --from=client-build /build/client/dist/client/browser /usr/share/nginx/html
|
|
|
|
COPY docker/nginx.conf /etc/nginx/http.d/default.conf
|
|
COPY docker/supervisord.conf /etc/supervisord.conf
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
|
CMD wget -qO- http://127.0.0.1/ >/dev/null || exit 1
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["supervisord", "-c", "/etc/supervisord.conf"]
|