From f1fa09c8e8e67a3894bd25e2749b4dac19252671 Mon Sep 17 00:00:00 2001 From: balex Date: Sun, 15 Mar 2026 22:23:10 +0100 Subject: [PATCH] auth media --- .gitignore | 1 + .gitlab-ci.yml | 69 +++++++++++++++++++++++++++++-------- auth-view/docker/Dockerfile | 6 ++-- 3 files changed, 58 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 7c20896..544c570 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea/ *.iml authid.txt +vps-config-docs.txt auth-view/node_modules/ auth-view/dist/ \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 10df571..c93a942 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,4 @@ + stages: - build - publish @@ -110,6 +111,26 @@ build-analytics-view: changes: - analytics-view/**/* +build-auth-view: + stage: build + image: node:22-alpine + cache: + key: "${CI_COMMIT_REF_SLUG}-auth-view" + paths: + - auth-view/node_modules + script: + - cd auth-view + - npm ci + - npm run build + artifacts: + paths: + - auth-view/dist + expire_in: 1h + rules: + - if: $CI_COMMIT_BRANCH == "main" + changes: + - auth-view/**/* + # ══════════════════════════════════════════════════════════ # PUBLISH DOCKER IMAGES # ══════════════════════════════════════════════════════════ @@ -209,6 +230,25 @@ publish-analytics-view: changes: - analytics-view/**/* +publish-auth-view: + stage: publish + image: docker:27 + services: + - docker:27-dind + variables: + DOCKER_TLS_CERTDIR: "" + before_script: + - echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin + script: + - docker build -t $REGISTRY/auth-view:${CI_COMMIT_SHORT_SHA} -t $REGISTRY/auth-view:latest -f auth-view/docker/Dockerfile auth-view/ + - docker push $REGISTRY/auth-view:${CI_COMMIT_SHORT_SHA} + - docker push $REGISTRY/auth-view:latest + needs: [build-auth-view] + rules: + - if: $CI_COMMIT_BRANCH == "main" + changes: + - auth-view/**/* + # ══════════════════════════════════════════════════════════ # DEPLOY TO VPS # ══════════════════════════════════════════════════════════ @@ -321,25 +361,24 @@ deploy-analytics-view: docker image prune -af ENDSSH -build-auth-view: - stage: build - image: node:22-alpine - cache: - key: "${CI_COMMIT_REF_SLUG}-auth-view" - paths: - - auth-view/node_modules - script: - - cd auth-view - - npm ci - - npm run build - artifacts: - paths: - - auth-view/dist - expire_in: 1h +deploy-auth-view: + <<: *deploy_setup + needs: [publish-auth-view] rules: - if: $CI_COMMIT_BRANCH == "main" changes: - auth-view/**/* + script: + - | + ssh $VPS_USER@$VPS_HOST << ENDSSH + set -e + echo "$CI_REGISTRY_PASSWORD" | docker login registry.gitlab.com -u "$CI_REGISTRY_USER" --password-stdin + cd /opt/services + export CI_COMMIT_SHORT_SHA=${CI_COMMIT_SHORT_SHA} + docker compose -f docker-compose.yml -f docker-compose.prod.yml pull auth-view + docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d auth-view + docker image prune -af + ENDSSH # Deploy all services at once (manual trigger) deploy-all: diff --git a/auth-view/docker/Dockerfile b/auth-view/docker/Dockerfile index f6df72a..20019e9 100644 --- a/auth-view/docker/Dockerfile +++ b/auth-view/docker/Dockerfile @@ -1,11 +1,11 @@ -FROM node:22-alpine AS build +FROM --platform=linux/amd64 node:22-alpine AS build WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci COPY . . RUN npm run build -FROM nginx:alpine +FROM --platform=linux/amd64 nginx:alpine COPY docker/nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/dist /usr/share/nginx/html/auth -EXPOSE 80 +EXPOSE 80 \ No newline at end of file