@@ -2,29 +2,27 @@ name: Run Podman Compose (Build & Deploy)
22
33on :
44 push :
5- branches :
6- - main
5+ branches : [ main ]
76 pull_request :
87
98jobs :
109 podman-compose :
11- # Use this for GitHub-hosted runners
1210 runs-on : ubuntu-latest
1311
1412 steps :
15- # Step 1: Checkout repository
13+ # Step 1: Checkout code
1614 - name : Checkout code
1715 uses : actions/checkout@v4
1816
19- # Step 2: Free up disk space on GitHub runner
17+ # Step 2: Free up disk space
2018 - name : Free up disk space
2119 run : |
22- echo " Cleaning up disk space..."
20+ echo "Cleaning up disk space..."
2321 sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc || true
2422 sudo apt-get clean
2523 df -h
2624
27- # Step 3: Install Podman and podman-compose
25+ # Step 3: Install Podman and Podman Compose
2826 - name : Install Podman
2927 run : |
3028 sudo apt-get update -y
@@ -33,13 +31,26 @@ jobs:
3331 podman --version
3432 podman-compose --version
3533
36- # Step 4: Configure Podman storage to use a larger path
34+ # Step 4: Configure Podman storage
3735 - name : Configure Podman storage
3836 run : |
39- echo " Reconfiguring Podman storage to use /home/runner/work/_containers"
37+ echo "Reconfiguring Podman storage to use /home/runner/work/_containers"
4038 sudo mkdir -p /home/runner/work/_containers
41- sudo bash -c 'echo "graphroot=\"/home/runner/work/_containers\"" >> /etc/containers/storage.conf'
42- df -h
39+ sudo mkdir -p /etc/containers
40+
41+ # If storage.conf doesn't exist, create a minimal one
42+ if [ ! -f /etc/containers/storage.conf ]; then
43+ echo "Creating new /etc/containers/storage.conf"
44+ echo '[storage]' | sudo tee /etc/containers/storage.conf
45+ fi
46+
47+ # Remove any existing graphroot entry and add the new one
48+ sudo sed -i '/graphroot/d' /etc/containers/storage.conf
49+ echo 'graphroot="/home/runner/work/_containers"' | sudo tee -a /etc/containers/storage.conf
50+
51+ echo "Final /etc/containers/storage.conf:"
52+ cat /etc/containers/storage.conf
53+
4354
4455 # Step 5: Ensure Podman network exists
4556 - name : Ensure network exists
@@ -52,33 +63,32 @@ jobs:
5263 echo "Network $NETWORK_NAME already exists"
5364 fi
5465
55- # Step 6: Build Podman images
66+ # Step 6: Build images
5667 - name : Build Podman images
5768 working-directory : demo
5869 run : |
59- echo " Building images..."
70+ echo "Building images..."
6071 podman-compose -f docker-compose.yaml build
61- echo " Build completed."
72+ echo "✅ Build completed."
6273
63- # Step 7: Run containers
74+ # Step 7: Start containers
6475 - name : Run Podman Compose
6576 working-directory : demo
6677 run : |
67- echo " Starting containers..."
78+ echo "Starting containers..."
6879 podman-compose -f docker-compose.yaml up -d
69- echo " Containers started."
70- echo " Running containers:"
80+ echo "Containers started."
7181 podman ps
7282
73- # Step 8: Verify network and container health
83+ # Step 8: Show network and container status
7484 - name : Verify Podman environment
7585 run : |
76- echo " Networks:"
86+ echo "Networks:"
7787 podman network ls
78- echo " Containers:"
88+ echo "Containers:"
7989 podman ps -a
8090
81- # Step 9: Show container logs
91+ # Step 9: Show container logs
8292 - name : Show Container Logs
8393 working-directory : demo
8494 run : |
@@ -90,11 +100,11 @@ jobs:
90100 podman logs "$container" || echo "No logs available for $container"
91101 done
92102
93- # Step 10: Stop and clean up containers (always runs)
103+ # Step 10: Stop & clean up
94104 - name : Stop and Clean Up
95105 if : always()
96106 working-directory : demo
97107 run : |
98108 echo "Cleaning up..."
99109 podman-compose -f docker-compose.yaml down
100- echo "Cleanup completed."
110+ echo " Cleanup completed."
0 commit comments