-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (31 loc) · 930 Bytes
/
cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: CD Pipeline
on:
workflow_run:
workflows: ["Build and Push Docker Image"]
types:
- completed
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker Hub
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Pull Docker images
run: |
docker pull muneer1997/demo_php:latest
docker pull muneer1997/demo_nginx:latest
- name: Stop and remove existing containers
run: |
docker-compose down || true
- name: Deploy with Docker Compose
run: |
docker-compose up -d
- name: Run composer install
run: |
docker-compose exec -T demo_php composer install
- name: Clean up old images
run: |
docker image prune -f