Skip to content

Commit 3ace14d

Browse files
committed
fix docker-compose
1 parent 7c02f68 commit 3ace14d

1 file changed

Lines changed: 47 additions & 17 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,78 @@ on:
66
pull_request:
77
branches: [ "main" ]
88

9-
jobs:
9+
env:
10+
# Enable BuildKit for all Docker operations
11+
DOCKER_BUILDKIT: 1
12+
COMPOSE_DOCKER_CLI_BUILD: 1
1013

14+
jobs:
1115
build:
1216
name: Build Docker image and push to repositories
1317
runs-on: ubuntu-latest
14-
18+
1519
steps:
1620
- name: Checkout code
17-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4 # Updated to v4
1822

1923
- name: Generate docker .env
2024
run: |
2125
python3 ./scripts/docker/generate_env.py
2226
2327
- name: Show generated .env (debug)
2428
run: |
25-
echo "--- content of scripts/docker/.env ---"
29+
echo "--- Content of scripts/docker/.env ---"
2630
cat scripts/docker/.env
27-
echo "-------------------------------------"
31+
echo "--------------------------------------"
2832
2933
- name: Set up Docker Buildx
30-
uses: docker/setup-buildx-action@v2
34+
uses: docker/setup-buildx-action@v3 # Updated to v3
35+
36+
- name: Build base images (ubuntu and library)
37+
working-directory: scripts/docker
38+
run: |
39+
# Build in correct dependency order
40+
docker compose build cosim-ubuntu
41+
docker compose build cosim-library
3142
32-
- name: Install docker-compose
43+
- name: Build main image (cosim-build)
44+
working-directory: scripts/docker
3345
run: |
34-
sudo apt-get update
35-
sudo apt-get install -y docker-compose
46+
# Build the main image
47+
docker compose build cosim-build
3648
37-
- name: Build (docker-compose)
49+
- name: List built images
3850
run: |
39-
cd scripts/docker
40-
docker-compose --profile build build
41-
# Note: running docker-compose from the directory containing the compose file
42-
# ensures it picks up the generated .env in this directory.
51+
echo "--- Built Docker Images ---"
52+
docker images | grep -E "(cosim|tesp)" || echo "No matching images found"
53+
echo "---------------------------"
4354
4455
- name: Smoke test built image
4556
run: |
46-
# determine version used for tagging
57+
# Determine version used for tagging
4758
VER=$(cat scripts/grid_version | tr -d '\n')
4859
echo "Using grid_version=${VER}"
49-
# quick smoke: run a simple Python command inside the built cosim-build image
50-
docker run --rm cosim-build:tesp_${VER} python3 -c "import sys; print('smoke ok'); sys.exit(0)"
60+
61+
# Quick smoke test: run a simple Python command inside the built image
62+
docker run --rm cosim-build:tesp_${VER} python3 -c "
63+
import sys
64+
print('Python version:', sys.version)
65+
try:
66+
import tesp_support
67+
print('tesp_support: OK')
68+
except ImportError as e:
69+
print('tesp_support: FAILED -', e)
70+
print('Smoke test: PASSED')
71+
sys.exit(0)
72+
"
73+
74+
# Optional: More comprehensive tests
75+
- name: Component verification
76+
run: |
77+
VER=$(cat scripts/grid_version | tr -d '\n')
78+
docker run --rm cosim-build:tesp_${VER} bash -c "
79+
echo '=== Component Verification ==='
80+
"
5181
5282
5383
# - name: Test

0 commit comments

Comments
 (0)