You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
SKB-online-sites/.drone.yml

64 lines
1.7 KiB

kind: pipeline
type: docker
name: build-and-deploy
steps:
# 1. Install dependencies and build the project
- name: install_and_build
image: node
commands:
- npm install
- npm run build
volumes:
- name: build
path: /drone/src
# 2. Deploy Docker container with Nginx and copy build files
- name: deploy
image: docker
volumes:
- name: docker_socket
path: /var/run/docker.sock
commands:
# 2.1 Останавливаем и удаляем старый контейнер Nginx (если есть)
- docker stop my-nginx-site || true
- docker rm my-nginx-site || true
# 2.2 Запускаем новый контейнер Nginx
- docker run -d --name my-nginx-site -p 80:80 nginx:stable-alpine
# 2.3 Копируем сгенерированные файлы в контейнер Nginx
- docker cp /drone/src/build/. my-nginx-site:/usr/share/nginx/html/
- name: telegram notification
image: appleboy/drone-telegram
settings:
token:
from_secret: telegram_token
to:
from_secret: telegram_to
format: markdown
when:
status:
- success
- failure
message: >
{{#success build.status}}
✅ Build #{{build.number}} of `{{repo.name}}` succeeded.
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
```
{{commit.message}}
```
🌐 {{ build.link }}
{{else}}
❌ Build #{{build.number}} of `{{repo.name}}` failed.
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
```
{{commit.message}}
```
🌐 {{ build.link }}
{{/success}}
volumes:
- name: build
temp: {}
- name: docker_socket
host:
path: /var/run/docker.sock