auth media

This commit is contained in:
2026-03-15 22:23:10 +01:00
parent ab999c558d
commit f1fa09c8e8
3 changed files with 58 additions and 18 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
.idea/
*.iml
authid.txt
vps-config-docs.txt
auth-view/node_modules/
auth-view/dist/

View File

@@ -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:

View File

@@ -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