Compare commits
3 Commits
fix
...
db458df1d6
| Author | SHA1 | Date | |
|---|---|---|---|
| db458df1d6 | |||
| 9d4fc2cff5 | |||
| 6655811cc1 |
@@ -1,20 +0,0 @@
|
||||
name: Ручная архивация
|
||||
|
||||
on:
|
||||
workflow_dispatch: # только ручной запуск
|
||||
|
||||
jobs:
|
||||
create-archives:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Проверка кода
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Загрузка артифакта
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-artifacts-${{ github.run_id }}
|
||||
path: |
|
||||
api/
|
||||
web/
|
||||
retention-days: 7
|
||||
@@ -12,129 +12,76 @@ jobs:
|
||||
test-backend:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Проверка кода
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Настройка Python
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Cache pip packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('api/requirements.txt') }}
|
||||
|
||||
- name: Установка зависимостей
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
cd api
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Подтверждение сборки
|
||||
- name: Verify build
|
||||
run: |
|
||||
python -c "from api.main import app"
|
||||
|
||||
- name: Запуск тестов
|
||||
- name: Run tests
|
||||
run: |
|
||||
pytest -q
|
||||
|
||||
test-frontend:
|
||||
needs: test-backend
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Проверка кода
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Настройка Node.js
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Установка зависимостей
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
cd web
|
||||
npm ci
|
||||
|
||||
- name: Сборка фронта
|
||||
- name: Build frontend
|
||||
run: |
|
||||
cd web
|
||||
npm run build
|
||||
|
||||
build-and-deploy:
|
||||
needs: test-backend
|
||||
|
||||
create-archives:
|
||||
needs: [test-backend, test-frontend]
|
||||
runs-on: ubuntu-latest
|
||||
if: success() # Запускается только если тесты прошли успешно
|
||||
|
||||
if: always() && !cancelled()
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.rlkdev.ru # Замените на ваш Gitea registry
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ hashFiles('api/requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
# - name: Create archives
|
||||
# run: |
|
||||
# echo "Creating full-build.zip with api and web..."
|
||||
# # Создаём единый архив, включающий папки api и web, с исключениями
|
||||
# zip -r full-build.zip api/ web/ \
|
||||
# -x "api/*.pyc" "api/*__pycache__*" "api/.git*" "api/.pytest_cache*" \
|
||||
# -x "web/node_modules/*" "web/.git*" "web/dist/*" "web/*.log" \
|
||||
# || echo "Warning: zip command had issues"
|
||||
# # Проверяем, что файл создан
|
||||
# ls -la full-build.zip
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
load: true
|
||||
tags: git.rlkdev.ru/rlk/fastapi-app:latest
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
|
||||
|
||||
- name: Stop and remove old container
|
||||
run: |
|
||||
docker stop fastapi-test-container || true
|
||||
docker rm fastapi-test-container || true
|
||||
|
||||
- name: Run new container
|
||||
run: |
|
||||
docker run -d \
|
||||
--name fastapi-test-container \
|
||||
-p 8080:8000 \
|
||||
--restart unless-stopped \
|
||||
git.rlkdev.ru/rlk/fastapi-app:latest
|
||||
|
||||
- name: Wait for container to be ready
|
||||
run: |
|
||||
timeout=60
|
||||
interval=2
|
||||
elapsed=0
|
||||
while [ $elapsed -lt $timeout ]; do
|
||||
if docker logs fastapi-test-container 2>&1 | grep -q "Application startup complete"; then
|
||||
echo "Application startup detected in logs"
|
||||
echo "Deployment successful!"
|
||||
exit 0
|
||||
fi
|
||||
echo "Waiting for startup log... ($elapsed/$timeout sec)"
|
||||
sleep $interval
|
||||
elapsed=$((elapsed + interval))
|
||||
done
|
||||
echo "Timeout: Application startup not detected in logs"
|
||||
docker logs fastapi-container
|
||||
exit 1
|
||||
|
||||
- name: Clean up dangling images
|
||||
run: |
|
||||
echo "Removing old dangling images..."
|
||||
docker image prune -f
|
||||
echo "Current images after cleanup:"
|
||||
docker images
|
||||
name: build-artifacts-${{ github.run_id }}
|
||||
path: |
|
||||
api/
|
||||
web/
|
||||
retention-days: 7
|
||||
|
||||
# Явный статус для PR
|
||||
pr-status:
|
||||
@@ -142,7 +89,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
if: always() && github.event_name == 'pull_request'
|
||||
steps:
|
||||
- name: Проверка статуса и обновление PR
|
||||
- name: Check status and update PR
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
@@ -150,11 +97,11 @@ jobs:
|
||||
if [[ "${{ needs.test-backend.result }}" == "success" ]] && \
|
||||
[[ "${{ needs.test-frontend.result }}" == "success" ]]; then
|
||||
STATE="success"
|
||||
DESCRIPTION="✅ Все проверки прошли успешно"
|
||||
DESCRIPTION="✅ All checks passed successfully"
|
||||
EXIT_CODE=0
|
||||
else
|
||||
STATE="failure"
|
||||
DESCRIPTION="❌ Некоторые проверки сломались"
|
||||
DESCRIPTION="❌ Some checks failed"
|
||||
EXIT_CODE=1
|
||||
fi
|
||||
|
||||
@@ -178,3 +125,54 @@ jobs:
|
||||
|
||||
# Выходим с соответствующим кодом, чтобы блокировать PR при неудаче
|
||||
exit $EXIT_CODE
|
||||
|
||||
# Опционально: добавляем комментарий в PR при неудаче
|
||||
comment-on-failure:
|
||||
needs: [test-backend, test-frontend, pr-status]
|
||||
runs-on: ubuntu-latest
|
||||
if: failure() && github.event_name == 'pull_request'
|
||||
steps:
|
||||
- name: Add failure comment to PR
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
# Определяем какие проверки не прошли
|
||||
BACKEND_STATUS="${{ needs.test-backend.result }}"
|
||||
FRONTEND_STATUS="${{ needs.test-frontend.result }}"
|
||||
|
||||
COMMENT="## ❌ Проверки не пройдены!
|
||||
|
||||
### Результаты проверок:
|
||||
| Проверка | Статус |
|
||||
|----------|--------|
|
||||
| **Backend tests** | $( [ "$BACKEND_STATUS" = "success" ] && echo "✅ Успешно" || echo "❌ Ошибка" ) |
|
||||
| **Frontend build** | $( [ "$FRONTEND_STATUS" = "success" ] && echo "✅ Успешно" || echo "❌ Ошибка" ) |
|
||||
|
||||
### Детали:
|
||||
- **Ветка**: ${{ github.head_ref }}
|
||||
- **Коммит**: \`${{ github.event.pull_request.head.sha }}\`
|
||||
- **Запуск**: [Смотреть детали](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
||||
|
||||
Пожалуйста, исправьте ошибки перед слиянием. 🚨"
|
||||
|
||||
# Находим PR номер
|
||||
PR_NUMBER=$(jq --raw-output .number "$GITHUB_EVENT_PATH")
|
||||
|
||||
# Добавляем комментарий
|
||||
curl -X POST "${{ github.api_url }}/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\": $(echo "$COMMENT" | jq -Rs .)}"
|
||||
|
||||
echo "Comment added to PR #$PR_NUMBER"
|
||||
|
||||
# Опционально: удаляем старые артефакты
|
||||
cleanup:
|
||||
needs: [create-archives, pr-status]
|
||||
runs-on: ubuntu-latest
|
||||
if: always()
|
||||
steps:
|
||||
- name: Clean up old artifacts
|
||||
run: |
|
||||
echo "Cleaning up temporary files"
|
||||
# Здесь можно добавить логику очистки, если нужно
|
||||
314
.gitea/workflows/multistep.yaml
Normal file
314
.gitea/workflows/multistep.yaml
Normal file
@@ -0,0 +1,314 @@
|
||||
# name: Release pipeline
|
||||
|
||||
# on:
|
||||
# workflow_dispatch:
|
||||
|
||||
# env:
|
||||
# WEB_IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-web
|
||||
# WORKER_IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-worker
|
||||
# PROJECT_DIR: /home/${{ secrets.USER }}/tatikoma
|
||||
|
||||
# jobs:
|
||||
# build-and-push:
|
||||
# runs-on: ubuntu-latest
|
||||
|
||||
# steps:
|
||||
# - name: Checkout code
|
||||
# uses: actions/checkout@v4
|
||||
|
||||
# - name: Set up Docker Buildx
|
||||
# uses: docker/setup-buildx-action@v3
|
||||
|
||||
# - name: Log in to Docker Hub
|
||||
# uses: docker/login-action@v3
|
||||
# with:
|
||||
# username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
# password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
# - name: Build and push tatikoma-web image
|
||||
# uses: docker/build-push-action@v5
|
||||
# with:
|
||||
# context: .
|
||||
# file: ./Dockerfile.web
|
||||
# push: true
|
||||
# tags: |
|
||||
# ${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-web:latest
|
||||
# cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-web:latest
|
||||
# cache-to: type=inline
|
||||
|
||||
# - name: Build and push tatikoma-worker image
|
||||
# uses: docker/build-push-action@v5
|
||||
# with:
|
||||
# context: .
|
||||
# file: ./Dockerfile.worker
|
||||
# push: true
|
||||
# tags: |
|
||||
# ${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-worker:latest
|
||||
# cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-worker:latest
|
||||
# cache-to: type=inline
|
||||
|
||||
# - name: Verify push
|
||||
# run: |
|
||||
# echo "Docker images successfully built and pushed to Docker Hub"
|
||||
# echo "Images:"
|
||||
# echo "- ${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-web:latest"
|
||||
# echo "- ${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-worker:latest"
|
||||
|
||||
# build-and-push-send-success-message:
|
||||
# runs-on: ubuntu-latest
|
||||
# needs: build-and-push
|
||||
# if: success()
|
||||
# steps:
|
||||
# - name: Send success message
|
||||
# uses: appleboy/telegram-action@master
|
||||
# with:
|
||||
# to: ${{ secrets.TELEGRAM_TO }}
|
||||
# token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||
# format: markdown
|
||||
# message: |
|
||||
# *${{ github.workflow }}*
|
||||
|
||||
# ✅ New images pushed to Dockerhub 🐳
|
||||
|
||||
# Images:
|
||||
# - `${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-web:latest`
|
||||
# - `${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-worker:latest`
|
||||
|
||||
# Status: Success
|
||||
|
||||
# build-and-push-send-failure-message:
|
||||
# runs-on: ubuntu-latest
|
||||
# needs: build-and-push
|
||||
# if: failure()
|
||||
# steps:
|
||||
# - name: Send failure message
|
||||
# uses: appleboy/telegram-action@master
|
||||
# with:
|
||||
# to: ${{ secrets.TELEGRAM_TO }}
|
||||
# token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||
# format: markdown
|
||||
# message: |
|
||||
# *${{ github.workflow }}*
|
||||
|
||||
# ❌ Error creating and pushing docker images
|
||||
|
||||
# [View failed workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
||||
|
||||
# deploy:
|
||||
# name: Deploy to server
|
||||
# runs-on: ubuntu-latest
|
||||
# needs: build-and-push
|
||||
# if: success()
|
||||
# outputs:
|
||||
# container_status: ${{ steps.get_status.outputs.status }}
|
||||
|
||||
# steps:
|
||||
# - name: Checkout code
|
||||
# uses: actions/checkout@v4
|
||||
|
||||
# - name: Create project directory
|
||||
# uses: appleboy/ssh-action@master
|
||||
# with:
|
||||
# host: ${{ secrets.HOST }}
|
||||
# username: ${{ secrets.USER }}
|
||||
# password: ${{ secrets.SSH_PASSWORD }}
|
||||
# script: |
|
||||
# set -e
|
||||
# echo "Creating project directory..."
|
||||
# mkdir -p tatikoma/liquibase
|
||||
# mkdir -p tatikoma/liquibase/changelog
|
||||
|
||||
# - name: Copy project files
|
||||
# shell: bash
|
||||
# run: |
|
||||
# # Копируем docker-compose.yml
|
||||
# sshpass -p "${{ secrets.SSH_PASSWORD }}" scp -o StrictHostKeyChecking=no \
|
||||
# docker-compose.yml \
|
||||
# ${{ secrets.USER }}@${{ secrets.HOST }}:tatikoma/
|
||||
|
||||
# # Копируем liquibase файлы
|
||||
# sshpass -p "${{ secrets.SSH_PASSWORD }}" scp -o StrictHostKeyChecking=no \
|
||||
# -r ./liquibase/changelog/ \
|
||||
# ${{ secrets.USER }}@${{ secrets.HOST }}:tatikoma/liquibase/
|
||||
|
||||
# # Копируем nginx конфиги
|
||||
# sshpass -p "${{ secrets.SSH_PASSWORD }}" scp -o StrictHostKeyChecking=no \
|
||||
# -r ./nginx/ \
|
||||
# ${{ secrets.USER }}@${{ secrets.HOST }}:tatikoma/
|
||||
|
||||
# - name: Create or update environment file
|
||||
# uses: appleboy/ssh-action@master
|
||||
# with:
|
||||
# host: ${{ secrets.HOST }}
|
||||
# username: ${{ secrets.USER }}
|
||||
# password: ${{ secrets.SSH_PASSWORD }}
|
||||
# script: |
|
||||
# set -e
|
||||
# cd tatikoma
|
||||
# rm -f .env
|
||||
# touch .env
|
||||
# echo "${{ secrets.ENV_FILE }}" >> .env
|
||||
# echo "Environment file created/updated"
|
||||
|
||||
# - name: Prepare directories
|
||||
# uses: appleboy/ssh-action@master
|
||||
# with:
|
||||
# host: ${{ secrets.HOST }}
|
||||
# username: ${{ secrets.USER }}
|
||||
# password: ${{ secrets.SSH_PASSWORD }}
|
||||
# script: |
|
||||
# set -e
|
||||
# cd tatikoma
|
||||
# mkdir -p {nginx/ssl,nginx/htpasswd,uptime-kuma-data}
|
||||
|
||||
# - name: Setup authentication
|
||||
# uses: appleboy/ssh-action@master
|
||||
# with:
|
||||
# host: ${{ secrets.HOST }}
|
||||
# username: ${{ secrets.USER }}
|
||||
# password: ${{ secrets.SSH_PASSWORD }}
|
||||
# script: |
|
||||
# set -e
|
||||
# cd tatikoma
|
||||
|
||||
# echo "Setting up authentication..."
|
||||
|
||||
# mkdir -p nginx/htpasswd
|
||||
|
||||
# if ! command -v htpasswd &> /dev/null; then
|
||||
# echo "Installing apache2-utils..."
|
||||
# apt-get update && apt-get install -y apache2-utils
|
||||
# fi
|
||||
|
||||
# # Используем echo для передачи пароля через stdin
|
||||
# # Это безопаснее, чем передавать как аргумент
|
||||
# htpasswd -b -c nginx/htpasswd/.htpasswd "${{ secrets.UPTIME_KUMA_USER }}" "${{ secrets.UPTIME_KUMA_PASSWORD }}"
|
||||
|
||||
# echo "Authentication setup complete"
|
||||
|
||||
# - name: Setup SSL certificates (if not exists)
|
||||
# uses: appleboy/ssh-action@master
|
||||
# with:
|
||||
# host: ${{ secrets.HOST }}
|
||||
# username: ${{ secrets.USER }}
|
||||
# password: ${{ secrets.SSH_PASSWORD }}
|
||||
# script: |
|
||||
# set -e
|
||||
# cd tatikoma
|
||||
|
||||
# echo "Checking SSL certificates..."
|
||||
# # Проверяем существование SSL сертификатов
|
||||
# if [ ! -f "nginx/ssl/live/${{ secrets.HOST }}/privkey.pem" ]; then
|
||||
# echo "ERROR: SSL certificates not found!"
|
||||
# echo "Please generate SSL certificates manually first:"
|
||||
# echo "mkdir -p nginx/ssl/live/${{ secrets.HOST }}/"
|
||||
# echo "Then place privkey.pem and fullchain.pem in that directory"
|
||||
# exit 1
|
||||
# else
|
||||
# echo "SSL certificates found, continuing..."
|
||||
# fi
|
||||
|
||||
# - name: Log in to Docker Hub
|
||||
# uses: docker/login-action@v3
|
||||
# with:
|
||||
# username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
# password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
# - name: Clean up old images and containers
|
||||
# uses: appleboy/ssh-action@master
|
||||
# with:
|
||||
# host: ${{ secrets.HOST }}
|
||||
# username: ${{ secrets.USER }}
|
||||
# password: ${{ secrets.SSH_PASSWORD }}
|
||||
# script: |
|
||||
# set -e
|
||||
# echo "Stopping and removing Tatikoma containers..."
|
||||
# docker stop tatikoma_web tatikoma_liquibase tatikoma_worker tatikoma_nginx tatikoma_uptime_kuma 2>/dev/null || true
|
||||
# docker rm tatikoma_web tatikoma_liquibase tatikoma_worker tatikoma_nginx tatikoma_uptime_kuma 2>/dev/null || true
|
||||
|
||||
# echo "Cleaning up old Docker images..."
|
||||
# docker images lulufox/tatikoma-web --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.CreatedAt}}" || true
|
||||
# docker images lulufox/tatikoma-worker --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.CreatedAt}}" || true
|
||||
|
||||
# docker rmi $(docker images lulufox/tatikoma-web -q) 2>/dev/null || true
|
||||
# docker rmi $(docker images lulufox/tatikoma-worker -q) 2>/dev/null || true
|
||||
|
||||
# docker image prune -f
|
||||
|
||||
# - name: Pull latest images
|
||||
# uses: appleboy/ssh-action@master
|
||||
# with:
|
||||
# host: ${{ secrets.HOST }}
|
||||
# username: ${{ secrets.USER }}
|
||||
# password: ${{ secrets.SSH_PASSWORD }}
|
||||
# script: |
|
||||
# set -e
|
||||
# echo "Pulling latest Docker images..."
|
||||
# docker pull lulufox/tatikoma-web:latest
|
||||
# docker pull lulufox/tatikoma-worker:latest
|
||||
|
||||
# - name: Run migrations
|
||||
# uses: appleboy/ssh-action@master
|
||||
# with:
|
||||
# host: ${{ secrets.HOST }}
|
||||
# username: ${{ secrets.USER }}
|
||||
# password: ${{ secrets.SSH_PASSWORD }}
|
||||
# script: |
|
||||
# set -e
|
||||
# cd tatikoma
|
||||
# echo "Running migrations..."
|
||||
# docker compose up -d liquibase
|
||||
|
||||
# - name: Start application services
|
||||
# uses: appleboy/ssh-action@master
|
||||
# with:
|
||||
# host: ${{ secrets.HOST }}
|
||||
# username: ${{ secrets.USER }}
|
||||
# password: ${{ secrets.SSH_PASSWORD }}
|
||||
# script: |
|
||||
# set -e
|
||||
# cd tatikoma
|
||||
# echo "Starting all services..."
|
||||
# docker compose up -d
|
||||
|
||||
# echo "Waiting for services to start..."
|
||||
# sleep 30
|
||||
|
||||
# echo "Current Tatikoma containers status:"
|
||||
# docker ps --filter "name=tatikoma" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
|
||||
|
||||
# echo "Nginx configuration test:"
|
||||
# docker exec tatikoma_nginx nginx -t || true
|
||||
|
||||
# - name: Get container status
|
||||
# id: get_status
|
||||
# run: |
|
||||
# sleep 15
|
||||
# status=$(sshpass -p "${{ secrets.SSH_PASSWORD }}" ssh -o StrictHostKeyChecking=no \
|
||||
# ${{ secrets.USER }}@${{ secrets.HOST }} \
|
||||
# "docker ps -a --filter "name=tatikoma" --format 'table {{.Names}}\t{{.Status}}'")
|
||||
# echo "status<<EOF" >> $GITHUB_OUTPUT
|
||||
# echo "$status" >> $GITHUB_OUTPUT
|
||||
# echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
# send_message:
|
||||
# runs-on: ubuntu-latest
|
||||
# needs: deploy
|
||||
# if: always()
|
||||
# steps:
|
||||
# - name: send message
|
||||
# uses: appleboy/telegram-action@master
|
||||
# with:
|
||||
# to: ${{ secrets.TELEGRAM_TO }}
|
||||
# token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||
# format: markdown
|
||||
# message: |
|
||||
# *${{ github.workflow }}*
|
||||
# Репозиторий: \`${{ github.repository }}\`
|
||||
|
||||
# Статус контейнеров:
|
||||
# ```
|
||||
# ${{ needs.deploy.outputs.container_status || 'Не удалось получить статус' }}
|
||||
# ```
|
||||
|
||||
# Uptime Kuma доступен по: https://${{ secrets.HOST }}
|
||||
17
.gitea/workflows/test.yaml
Normal file
17
.gitea/workflows/test.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# name: Test Workflow
|
||||
|
||||
# on:
|
||||
# push:
|
||||
|
||||
# jobs:
|
||||
# test:
|
||||
# runs-on: ubuntu-latest
|
||||
|
||||
# steps:
|
||||
# - name: Print environment variables
|
||||
# run: |
|
||||
# echo "GITHUB_REPOSITORY: $GITHUB_REPOSITORY"
|
||||
# echo "GITHUB_SHA: $GITHUB_SHA"
|
||||
# echo "GITHUB_REF: $GITHUB_REF"
|
||||
# echo "GITHUB_ACTOR: $GITHUB_ACTOR"
|
||||
# echo "PATH: $PATH"
|
||||
16
Dockerfile
16
Dockerfile
@@ -1,16 +0,0 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 1. Копируем только файл с зависимостями (меняется редко)
|
||||
COPY api/requirements.txt requirements.txt
|
||||
|
||||
# 2. Устанавливаем зависимости (слой кэшируется, пока не изменился requirements.txt)
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# 3. Копируем весь остальной код (меняется часто)
|
||||
COPY api/ api/
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
Reference in New Issue
Block a user