Skip to content

Commit 63229b6

Browse files
committed
fix: исправлен GitHub Action для сборки документации
- Удалён builder stage из Dockerfile (сборка теперь в GitHub Actions) - Исправлен контекст Docker сборки на ./docs - Добавлена ветка master в триггеры workflow - Обновлено условие для тега latest (master и main)
1 parent 1ac9a57 commit 63229b6

2 files changed

Lines changed: 10 additions & 29 deletions

File tree

.github/workflows/build-vitepress-docs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Build VitePress Docs and Push to Harbor
33
on:
44
push:
55
branches:
6+
- master
67
- main
78
- develop
89
paths:
@@ -88,14 +89,14 @@ jobs:
8889
type=ref,event=pr
8990
type=semver,pattern={{version}}
9091
type=semver,pattern={{major}}.{{minor}}
91-
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
92+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') || github.ref == format('refs/heads/{0}', 'main') }}
9293
type=raw,value=${{ github.event.inputs.image_tag }},enable=${{ github.event_name == 'workflow_dispatch' }}
9394
type=sha,prefix=,format=short
9495
9596
- name: Build and push Docker image
9697
uses: docker/build-push-action@v5
9798
with:
98-
context: .
99+
context: ./docs
99100
file: ./docs/Dockerfile
100101
push: true
101102
tags: ${{ steps.meta.outputs.tags }}

docs/Dockerfile

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,11 @@
22
# Dockerfile for VitePress Documentation
33
# Integration Subsystem (Подсистема интеграции)
44
# =============================================================================
5-
6-
# Build stage (if not using pre-built artifacts)
7-
FROM node:20-alpine AS builder
8-
9-
WORKDIR /app
10-
11-
# Copy package files
12-
COPY docs/package*.json ./
13-
14-
# Install dependencies
15-
RUN npm ci --only=production
16-
17-
# Copy documentation source
18-
COPY docs/ ./
19-
20-
# Build VitePress
21-
RUN npm run docs:build
22-
23-
# =============================================================================
24-
# Production stage - nginx for serving static files
5+
#
6+
# This Dockerfile expects pre-built VitePress artifacts in docs/.vitepress/dist
7+
# Build is done by GitHub Actions before Docker build
258
# =============================================================================
9+
2610
FROM nginx:1.25-alpine AS production
2711

2812
LABEL maintainer="Integration Subsystem Team"
@@ -44,14 +28,10 @@ RUN apk add --no-cache curl
4428
RUN rm -rf /usr/share/nginx/html/*
4529

4630
# Copy custom nginx configuration
47-
COPY docs/nginx.conf /etc/nginx/nginx.conf
48-
49-
# Copy built documentation from builder stage
50-
# If using GitHub Actions artifact, this will be overwritten by the mounted dist folder
51-
COPY --from=builder /app/.vitepress/dist /usr/share/nginx/html
31+
COPY nginx.conf /etc/nginx/nginx.conf
5232

53-
# Alternatively, if dist is pre-built and passed as context:
54-
# COPY docs/.vitepress/dist /usr/share/nginx/html
33+
# Copy pre-built documentation (built by GitHub Actions)
34+
COPY .vitepress/dist /usr/share/nginx/html
5535

5636
# Set proper permissions
5737
RUN chown -R nginx:nginx /usr/share/nginx/html && \

0 commit comments

Comments
 (0)