-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (43 loc) · 1.46 KB
/
ci-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
41
42
43
44
45
46
47
48
49
50
51
52
name: CI/CD Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
services:
docker:
image: docker:20.10.16
options: --privileged
ports:
- 3000:3000
- 4000:4000
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/v2.18.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push app image
run: |
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml up -d
- name: Push Docker images
run: |
docker tag blog-app-app:latest ${{ secrets.DOCKER_USERNAME }}/blog-app-app:latest
docker tag blog-app-server:latest ${{ secrets.DOCKER_USERNAME }}/blog-app-server:latest
docker push ${{ secrets.DOCKER_USERNAME }}/blog-app-app:latest
docker push ${{ secrets.DOCKER_USERNAME }}/blog-app-server:latest