diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c9a3f05..a734261 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -54,6 +54,15 @@ build_backend-staticfiles: DOCKERFILE_PATH: "Dockerfile.staticfiles" IMAGE_NAME: "$CI_REGISTRY_IMAGE/backend-staticfiles" +build_docs: + <<: *build-template + rules: + - if: '$CI_COMMIT_REF_NAME == "master"' + variables: + CONTEXT: "${CI_PROJECT_DIR}/docs" + DOCKERFILE_PATH: "Dockerfile" + IMAGE_NAME: "$CI_REGISTRY_IMAGE/docs" + deploy: image: kroniak/ssh-client:3.19 stage: deploy diff --git a/compose.yaml b/compose.yaml index 21501ef..9aac6d8 100644 --- a/compose.yaml +++ b/compose.yaml @@ -356,6 +356,20 @@ services: source: prometheus_data target: /prometheus + docs: + image: gitlab.prodcontest.ru:5050/team-15/project/docs:latest + build: + context: ./docs + dockerfile: Dockerfile + ports: + - name: web + target: 3000 + published: 8008 + host_ip: 0.0.0.0 + protocol: tcp + restart: unless-stopped + shm_size: 4mb + proxy: image: docker.io/nginx:1.27-alpine3.21 configs: diff --git a/docs/Dockerfile b/docs/Dockerfile new file mode 100644 index 0000000..ee2e828 --- /dev/null +++ b/docs/Dockerfile @@ -0,0 +1,26 @@ +# Stage 1: Base image +FROM node:lts AS base + +ENV FORCE_COLOR=0 + +RUN corepack enable + +WORKDIR /opt/docusaurus + +# Stage 2: Production build mode +FROM base AS prod + +WORKDIR /opt/docusaurus + +COPY . /opt/docusaurus/ + +RUN npm ci + +RUN npm run build + +# Stage 3: Serve with docusaurus serve +FROM prod AS serve + +EXPOSE 3000 + +CMD ["npm", "run", "serve", "--", "--host", "0.0.0.0", "--no-open"] diff --git a/infrastructure/nginx/nginx.conf b/infrastructure/nginx/nginx.conf index 6e338eb..dff0f61 100644 --- a/infrastructure/nginx/nginx.conf +++ b/infrastructure/nginx/nginx.conf @@ -110,6 +110,24 @@ http { proxy_read_timeout 600s; } + location /docs { + proxy_pass http://docs:3000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_cache_bypass $http_upgrade; + proxy_hide_header X-Powered-By; + + proxy_connect_timeout 75s; + proxy_send_timeout 600s; + proxy_read_timeout 600s; + } + location /static { rewrite ^/static/(.*)$ /$1 break; proxy_pass http://backend-staticfiles:80;