This commit is contained in:
MyServer 2025-05-02 19:55:32 +05:00
parent 17c7a359b1
commit 2377e07cf6
3 changed files with 21 additions and 10 deletions

Binary file not shown.

View File

@ -1,6 +1,5 @@
# Dockerfile # Этап сборки
FROM node:20-alpine AS builder
FROM node:20-alpine
WORKDIR /app WORKDIR /app
@ -8,9 +7,20 @@ COPY package*.json ./
RUN npm ci RUN npm ci
COPY . . COPY . .
RUN npm run build RUN npm run build
EXPOSE 39890 # Этап продакшна — отдача статики
FROM nginx:alpine AS production
CMD ["npm", "run", "preview", "--", "--port", "39890"] # Удаляем дефолтную страницу Nginx
RUN rm -rf /usr/share/nginx/html/*
# Копируем Astro-сборку
COPY --from=builder /app/dist /usr/share/nginx/html
# Опционально: свой nginx.conf
# COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -6,13 +6,14 @@ services:
container_name: kb-personal container_name: kb-personal
networks: networks:
- proxy-net - proxy-net
expose:
- 39890
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.kb-personal.rule=Host(`wiki.sinenikolsky.ru`)" - "traefik.http.routers.kb-personal.rule=Host(`wiki.sinenikolsky.ru`)"
- "traefik.http.routers.kb-personal.entrypoints=http" - "traefik.http.routers.kb-personal.entrypoints=http,https"
- "traefik.http.services.kb-personal.loadbalancer.server.port=39890" - "traefik.http.routers.kb-personal.tls=true"
- "traefik.http.services.kb-personal.loadbalancer.server.port=80"
expose:
- 80
restart: unless-stopped restart: unless-stopped
networks: networks: