You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- main # Change this to your default branch if it's not `main`
7
+
pull_request:
8
+
branches:
9
+
- main
10
+
11
+
jobs:
12
+
build-and-up:
13
+
runs-on: ubuntu-latest
14
+
15
+
steps:
16
+
- name: Checkout repository
17
+
uses: actions/checkout@v2
18
+
19
+
- name: Set up Docker Buildx
20
+
uses: docker/setup-buildx-action@v2
21
+
22
+
- name: Login to DockerHub
23
+
uses: docker/login-action@v2
24
+
with:
25
+
username: ${{ secrets.DOCKER_USERNAME }}
26
+
password: ${{ secrets.DOCKER_TOKEN }}
27
+
28
+
- name: Set up QEMU
29
+
uses: docker/setup-qemu-action@v2
30
+
31
+
- name: Clean up Docker to free space
32
+
run: |
33
+
docker system prune -f
34
+
docker volume prune -f
35
+
36
+
- name: Cache Docker layers
37
+
uses: actions/cache@v3
38
+
with:
39
+
path: /tmp/.buildx-cache
40
+
key: ${{ runner.os }}-buildx-${{ github.sha }}
41
+
restore-keys: |
42
+
${{ runner.os }}-buildx-
43
+
44
+
- name: Build and run Docker Compose
45
+
run: docker-compose -f docker-compose.yaml up --build -d
46
+
47
+
- name: Run tests (optional)
48
+
run: docker-compose -f docker-compose.yaml exec <service-name> <test-command> # Replace <service-name> and <test-command> with your service name and test command
49
+
50
+
- name: Tear down Docker Compose
51
+
if: always()
52
+
run: docker-compose -f docker-compose.yaml down
53
+
54
+
- name: Clean up Docker to free space (afterwards)
0 commit comments