Files
geovektor/Dockerfile

33 lines
1.0 KiB
Docker
Raw 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:20-alpine AS build
WORKDIR /app
# Установим зависимости
COPY package.json package-lock.json* ./
RUN npm ci || npm install
# Скопируем исходники и соберём продакшн-бандл
COPY . .
RUN npm run build
# Продакшн-слой с nginx
FROM nginx:1.27-alpine
# Конфиг nginx для SPA (React Router)
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Копируем собранный фронтенд
COPY --from=build /app/dist /usr/share/nginx/html
# Дополнительно копируем папку js с tailwind.js,
# т.к. Vite не кладёт её в dist автоматически, а index.html на неё ссылается
COPY --from=build /app/js /usr/share/nginx/html/js
# И статику из media (иконки, картинки), на которые есть ссылки из index.html и компонентов
COPY --from=build /app/media /usr/share/nginx/html/media
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]