mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
Fix: Admin autorization1
This commit is contained in:
@@ -2,105 +2,21 @@ image: python:3.11
|
|||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- build
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
variables:
|
|
||||||
SECRET_KEY: "your-super-secret-key-123"
|
|
||||||
|
|
||||||
test-backend:
|
test-backend:
|
||||||
image: python:3.11
|
|
||||||
stage: test
|
stage: test
|
||||||
tags: []
|
|
||||||
before_script:
|
|
||||||
- python -V
|
|
||||||
- python -m pip install --upgrade pip
|
|
||||||
- pip install pytest pytest-cov
|
|
||||||
- pip install -r backend/requirements.txt
|
|
||||||
script:
|
script:
|
||||||
|
- python -V
|
||||||
- cd backend
|
- cd backend
|
||||||
- python -m pytest -v tests/test_health.py
|
- pip install -r requirements.txt
|
||||||
only:
|
- python -m pytest tests/test_health.py -v
|
||||||
- main
|
tags: []
|
||||||
- Testing
|
|
||||||
|
|
||||||
test-frontend:
|
test-frontend:
|
||||||
image: node:18
|
|
||||||
stage: test
|
stage: test
|
||||||
tags: []
|
image: node:18
|
||||||
before_script:
|
script:
|
||||||
- cd frontend
|
- cd frontend
|
||||||
- npm install
|
- npm install
|
||||||
script:
|
|
||||||
- npm run test
|
- npm run test
|
||||||
only:
|
tags: []
|
||||||
- main
|
|
||||||
- Testing
|
|
||||||
|
|
||||||
build-backend:
|
|
||||||
stage: build
|
|
||||||
image: docker:latest
|
|
||||||
tags: []
|
|
||||||
variables:
|
|
||||||
DOCKER_TLS_CERTDIR: ""
|
|
||||||
services:
|
|
||||||
- name: docker:dind
|
|
||||||
alias: docker
|
|
||||||
command: ["--tls=false"]
|
|
||||||
before_script:
|
|
||||||
- docker info
|
|
||||||
script:
|
|
||||||
- cd backend
|
|
||||||
- docker build -t backend:latest .
|
|
||||||
- docker save backend:latest > backend.tar
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- backend/backend.tar
|
|
||||||
expire_in: 1 hour
|
|
||||||
only:
|
|
||||||
- main
|
|
||||||
|
|
||||||
build-frontend:
|
|
||||||
stage: build
|
|
||||||
image: docker:latest
|
|
||||||
tags: []
|
|
||||||
variables:
|
|
||||||
DOCKER_TLS_CERTDIR: ""
|
|
||||||
services:
|
|
||||||
- name: docker:dind
|
|
||||||
alias: docker
|
|
||||||
command: ["--tls=false"]
|
|
||||||
before_script:
|
|
||||||
- docker info
|
|
||||||
script:
|
|
||||||
- cd frontend
|
|
||||||
- docker build -t frontend:latest .
|
|
||||||
- docker save frontend:latest > frontend.tar
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- frontend/frontend.tar
|
|
||||||
expire_in: 1 hour
|
|
||||||
only:
|
|
||||||
- main
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
stage: deploy
|
|
||||||
image: python:3.11
|
|
||||||
tags: []
|
|
||||||
script:
|
|
||||||
- apt-get update -qy
|
|
||||||
- apt-get install -y sshpass
|
|
||||||
- sshpass -p "$SSH_PASSWORD" scp -o StrictHostKeyChecking=no backend/backend.tar frontend/frontend.tar docker-compose.yml root@185.139.70.62:/root/app/
|
|
||||||
- |
|
|
||||||
sshpass -p "$SSH_PASSWORD" ssh -o StrictHostKeyChecking=no root@185.139.70.62 "bash -c '
|
|
||||||
cd /root/app &&
|
|
||||||
docker load < backend.tar &&
|
|
||||||
docker load < frontend.tar &&
|
|
||||||
export SECRET_KEY=\"your-super-secret-key-123\" &&
|
|
||||||
/usr/bin/docker compose down &&
|
|
||||||
/usr/bin/docker compose up -d
|
|
||||||
'"
|
|
||||||
only:
|
|
||||||
- main
|
|
||||||
environment:
|
|
||||||
name: production
|
|
Reference in New Issue
Block a user