Files
k8s-oauth-demo-spa/dockerfile
2025-09-16 15:43:36 +05:00

42 lines
841 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Многоэтапная сборка для минимального размера образа
FROM node:18-alpine AS builder
WORKDIR /app
# Копируем package.json и package-lock.json (если есть)
COPY package*.json ./
# Устанавливаем зависимости
RUN npm ci
# Копируем исходный код
COPY . .
# Собираем приложение
RUN npm run build
RUN npm prune --production
# Финальный образ с nginx
FROM nginx:alpine
# Копируем собранное приложение
COPY --from=builder /app/dist /usr/share/nginx/html
# Копируем конфигурацию nginx для SPA
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Открываем порт 80
EXPOSE 80
# Запускаем nginx
CMD ["nginx", "-g", "daemon off;"]