This commit is contained in:
2026-05-03 08:50:17 +03:00
parent f3777684ee
commit 722b4a41ba
2 changed files with 80 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
version: "3.8"
networks:
shared-network:
services:
nginx:
image: nginx:1.27.2-alpine
container_name: nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./logs:/var/log/nginx
ports:
- "80:80"
- "443:443"
depends_on:
- backend
- frontend
networks:
- shared-network
backend:
build: .././backend
container_name: backend
ports:
- "5000:8080"
- "5001:8081"
networks:
- shared-network
frontend:
build: .././frontend
container_name: frontend
ports:
- "5002:80"
- "5003:443"
networks:
- shared-network
+44
View File
@@ -0,0 +1,44 @@
# этап 1.
name: build & test
on:
# Указываем ветки которые будут триггерить пайплайн
pull_request:
branches: ["release"]
types: [closed]
# Указываем триггер - опубликованный релиз
release:
types: [published]
workflow_call:
# позволяет запускать пайплайн вручную через вкладку Actions
workflow_dispatch:
# этап 2.
jobs:
build:
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
runs-on: self-hosted
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
ref: release
# этап 3.
- name: Move files to build deploy directory
run: |
mkdir -p ~/opt/development/frontend
cp -r * ~/opt/development/frontend/
- name: Check if Docker is installed
run: |
if ! command -v docker &> /dev/null; then
echo "Docker is not installed"
exit 1
fi
- name: Try to restart container
run: |
if [ -f ~/opt/development/docker/docker-compose.yml ]; then
echo "docker-compose.yml found, restarting container"
docker-compose -f ~/opt/development/docker/docker-compose.yml down
docker-compose -f ~/opt/development/docker/docker-compose.yml up -d
else
echo "docker-compose.yml not found, skipping docker-compose commands"
fi