Skip to content

Commit c19120b

Browse files
committed
slimming down workflows and docker steps
1 parent c0ec8f7 commit c19120b

File tree

3 files changed

+46
-41
lines changed

3 files changed

+46
-41
lines changed

.github/workflows/apptainer-build-local.yml

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Test Apptainer Build Local
22

33
on:
4+
push:
5+
branches: [ master ]
46
pull_request:
57
branches: [ master ]
68
workflow_run:
@@ -41,46 +43,14 @@ jobs:
4143
run: |
4244
make get-test-data
4345
44-
- name: Cache Docker images
45-
uses: actions/cache@v4
46-
id: docker-cache
47-
with:
48-
path: |
49-
mongo.tar
50-
api.tar
51-
handler.tar
52-
ui.tar
53-
key: docker-local-images-${{ github.event.workflow_run.head_sha || github.sha }}
54-
restore-keys: |
55-
docker-local-images-
56-
5746
- name: Setup environment
5847
run: |
5948
# copy the example.env to .env
6049
cp example.env .env
6150
6251
# Update .env to use the hostname
6352
sed -i "s/SERVER_NAME=.*/SERVER_NAME=localhost/" .env
64-
65-
- name: Build or load images
66-
run: |
67-
if [ -f mongo.tar ] && [ -f api.tar ] && [ -f handler.tar ] && [ -f ui.tar ]; then
68-
echo "Loading cached images..."
69-
if ! docker load < mongo.tar || ! docker load < api.tar || ! docker load < handler.tar || ! docker load < ui.tar; then
70-
echo "Failed to load cached images, building instead..."
71-
docker compose -f ${{ env.COMPOSE_FILE }} build
72-
else
73-
rm mongo.tar api.tar handler.tar ui.tar
74-
fi
75-
else
76-
echo "Building images..."
77-
docker compose -f ${{ env.COMPOSE_FILE }} build
78-
fi
7953
80-
# Tag the images to match docker-compose
81-
docker tag ${REGISTRY_PREFIX}/${REPO_NAME}-api:latest api:latest
82-
docker tag ${REGISTRY_PREFIX}/${REPO_NAME}-handler:latest handler:latest
83-
docker tag ${REGISTRY_PREFIX}/${REPO_NAME}-ui:latest ui:latest
8454
8555
- name: Clean Up some More Space
8656
run: bash .github/scripts/util_free_space.sh

.github/workflows/test-upload-local.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,26 @@ jobs:
7979
docker compose -f ${{ env.COMPOSE_FILE }} build
8080
fi
8181
82-
# Tag the images to match docker-compose
83-
docker tag ${REGISTRY_PREFIX}/${REPO_NAME}-api:latest api:latest
84-
docker tag ${REGISTRY_PREFIX}/${REPO_NAME}-handler:latest handler:latest
85-
docker tag ${REGISTRY_PREFIX}/${REPO_NAME}-ui:latest ui:latest
82+
83+
- name: Save images to cache
84+
run: |
85+
# Save images for future use
86+
docker save mongo:4.4.15 > mongo.tar
87+
docker save openneuropet/ezbids-api:latest > api.tar
88+
docker save openneuropet/ezbids-handler:latest > handler.tar
89+
docker save openneuropet/ezbids-ui:latest > ui.tar
90+
91+
- name: Cache Docker images
92+
uses: actions/cache@v4
93+
with:
94+
path: |
95+
mongo.tar
96+
api.tar
97+
handler.tar
98+
ui.tar
99+
key: test-local-docker-images-${{ github.event.workflow_run.head_sha || github.sha }}
100+
restore-keys: |
101+
test-local-docker-images-
86102
87103
- name: Start services
88104
run: |

.github/workflows/test-upload-nginx.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Test Nginx Upload
22

33
on:
4+
push:
5+
branches: [ master ]
46
pull_request:
57
branches: [ master ]
68
workflow_run:
@@ -89,9 +91,6 @@ jobs:
8991
docker compose -f ${{ env.COMPOSE_FILE }} build
9092
fi
9193
92-
# Tag the images to match docker-compose
93-
docker tag ${REGISTRY_PREFIX}/${REPO_NAME}-api:latest api:latest
94-
docker tag ${REGISTRY_PREFIX}/${REPO_NAME}-handler:latest handler:latest
9594
9695
- name: Build or load nginx images
9796
run: |
@@ -108,8 +107,28 @@ jobs:
108107
docker compose -f ${{ env.COMPOSE_FILE }} build
109108
fi
110109
111-
# Tag the UI image to match docker-compose
112-
docker tag ${REGISTRY_PREFIX}/${REPO_NAME}-ui:latest ui:latest
110+
111+
- name: Save nginx images to cache
112+
run: |
113+
# Save nginx-specific images for future use
114+
docker save mongo:4.4.15 > mongo.tar
115+
docker save openneuropet/ezbids-api:latest > api.tar
116+
docker save openneuropet/ezbids-handler:latest > handler.tar
117+
docker save openneuropet/ezbids-ui-nginx:latest > ui-nginx.tar
118+
docker save nginx:latest > nginx.tar
119+
120+
- name: Cache Docker images
121+
uses: actions/cache@v4
122+
with:
123+
path: |
124+
mongo.tar
125+
api.tar
126+
handler.tar
127+
ui-nginx.tar
128+
nginx.tar
129+
key: test-nginx-docker-images-${{ github.event.workflow_run.head_sha || github.sha }}
130+
restore-keys: |
131+
test-nginx-docker-images-
113132
114133
- name: Do additional Nginx setup
115134
run: |

0 commit comments

Comments
 (0)