Skip to content

Commit ed2fa14

Browse files
authored
Update docker tags and add dockerhub push (#61)
1 parent 91f3ee3 commit ed2fa14

File tree

9 files changed

+112
-100
lines changed

9 files changed

+112
-100
lines changed

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

Lines changed: 7 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
@@ -135,4 +105,9 @@ jobs:
135105
exit 1
136106
fi
137107
108+
- name: Push Images
109+
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch'
110+
run: |
111+
docker login ${{ secrets.DOCKER_USERNAME }} ${{ secrets.DOCKER_PASSWORD }}
112+
make docker-push-everything
138113

.github/workflows/docker-build-everything-image.yaml

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,6 @@ jobs:
4141
run: |
4242
make get-test-data
4343
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-
5744
- name: Setup environment
5845
run: |
5946
# copy the example.env to .env
@@ -62,33 +49,26 @@ jobs:
6249
# Update .env to use the hostname
6350
sed -i "s/SERVER_NAME=.*/SERVER_NAME=localhost/" .env
6451
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
79-
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
84-
8552
- name: Build Single Docker Image
8653
run: |
87-
docker build -f EverythingDockerfile -t ezbids-everything .
54+
docker build -f EverythingDockerfile -t openneuropet/ezbids-everything .
55+
56+
- name: Save everything image to cache
57+
run: |
58+
docker save openneuropet/ezbids-everything > everything.tar
59+
60+
- name: Cache everything image
61+
uses: actions/cache@v4
62+
with:
63+
path: |
64+
everything.tar
65+
key: docker-everything-images-${{ github.sha }}
66+
restore-keys: |
67+
docker-everything-images-
8868
8969
- name: Start Services
9070
run: |
91-
docker run -d -p 27017:27017 -p 8082:8082 -p 3000:3000 -p 8000:8000 -v /tmp/ezbids-workdir:/tmp ezbids-everything
71+
docker run -d -p 27017:27017 -p 8082:8082 -p 3000:3000 -p 8000:8000 -v /tmp/ezbids-workdir:/tmp openneuropet/ezbids-everything
9272
- name: Install uv
9373
run: |
9474
curl -LsSf https://astral.sh/uv/install.sh | sh
@@ -100,6 +80,4 @@ jobs:
10080
- name: Run upload test
10181
run: |
10282
make test-upload
103-
104-
105-
83+

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ jobs:
3232
run: |
3333
# Save images to tar files
3434
docker save mongo > mongo.tar
35-
docker save ${REGISTRY_PREFIX}/${REPO_NAME}-api:latest > api.tar
36-
docker save ${REGISTRY_PREFIX}/${REPO_NAME}-handler:latest > handler.tar
37-
docker save ${REGISTRY_PREFIX}/${REPO_NAME}-ui:latest > ui.tar
35+
docker save openneuropet/ezbids-api:latest > api.tar
36+
docker save openneuropet/ezbids-handler:latest > handler.tar
37+
docker save openneuropet/ezbids-ui:latest > ui.tar
3838
3939
- name: Cache Docker images
4040
uses: actions/cache@v4

.github/workflows/docker-build-nginx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
- name: Save images
6060
run: |
6161
# Save all ui and nginx images to tar files
62-
docker save ${REGISTRY_PREFIX}/${REPO_NAME}-ui:latest > ui-nginx.tar
62+
docker save openneuropet/ezbids-ui-nginx:latest > ui-nginx.tar
6363
docker save nginx > nginx.tar
6464
6565
- name: Cache Nginx images

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

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

33
on:
4+
push:
5+
branches: [ master ]
46
pull_request:
57
branches: [ master ]
68
workflow_run:
@@ -77,10 +79,6 @@ jobs:
7779
docker compose -f ${{ env.COMPOSE_FILE }} build
7880
fi
7981
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
8482
8583
- name: Start services
8684
run: |
@@ -103,3 +101,9 @@ jobs:
103101
- name: Run upload test
104102
run: |
105103
make test-upload
104+
105+
- name: Push Images
106+
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch'
107+
run: |
108+
docker login ${{ secrets.DOCKER_USERNAME }} ${{ secrets.DOCKER_PASSWORD }}
109+
make docker-local-push

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

Lines changed: 8 additions & 6 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,9 +107,6 @@ 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
113-
114110
- name: Do additional Nginx setup
115111
run: |
116112
# create self signed certs using the hostname
@@ -137,3 +133,9 @@ jobs:
137133
- name: Run upload test
138134
run: |
139135
make test-upload
136+
137+
- name: Push Images
138+
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch'
139+
run: |
140+
docker login ${{ secrets.DOCKER_USERNAME }} ${{ secrets.DOCKER_PASSWORD }}
141+
make docker-nginx-push

Makefile

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,26 @@ test-upload: setup-test
2626
clean-test:
2727
rm -rf test/.venv
2828
rm -rf test/__pycache__
29-
rm -rf test/.pytest_cache
29+
rm -rf test/.pytest_cache
30+
31+
# build local (non-nginx)
32+
docker-build-local:
33+
EZBIDS_VERSION=$(shell git describe --tags --always) docker compose build
34+
35+
# build nginx (non-nginx)
36+
docker-build-nginx:
37+
EZBIDS_VERSION=$(shell git describe --tags --always) docker compose -f docker-compose-nginx.yml build
38+
39+
docker-local-push:
40+
EZBIDS_VERSION=$(shell git describe --tags --always) docker compose push
41+
42+
docker-nginx-push:
43+
EZBIDS_VERSION=$(shell git describe --tags --always) docker compose -f docker-compose-nginx.yml push
44+
45+
docker-build-everything:
46+
docker build -f EverythingDockerfile -t openneuropet/ezbids-everything:latest .
47+
docker build -f EverythingDockerfile -t openneuropet/ezbids-everything:$(shell git describe --tags --always) .
48+
49+
docker-push-everything:
50+
docker push openneuropet/ezbids-everything:latest
51+
docker push openneuropet/ezbids-everything:$(shell git describe --tags --always)

docker-compose-nginx.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ networks:
33

44
services:
55
mongodb:
6-
container_name: brainlife_ezbids-mongodb
6+
container_name: ezbids-mongodb
77
image: mongo:4.4.15
88
platform: linux/amd64
99
volumes:
@@ -18,8 +18,13 @@ services:
1818
- ezbids
1919

2020
api:
21-
container_name: brainlife_ezbids-api
22-
build: .
21+
container_name: ezbids-api
22+
image: openneuropet/ezbids-api:${EZBIDS_VERSION:-latest}
23+
build:
24+
context: .
25+
tags:
26+
- openneuropet/ezbids-api:latest
27+
- openneuropet/ezbids-api:${EZBIDS_VERSION:-latest}
2328
platform: linux/amd64
2429
volumes:
2530
- ${EZBIDS_TMP_DIR:-/tmp/ezbids-workdir}:/tmp
@@ -38,9 +43,13 @@ services:
3843
- ezbids
3944

4045
handler:
41-
container_name: brainlife_ezbids-handler
46+
container_name: ezbids-handler
47+
image: openneuropet/ezbids-handler:${EZBIDS_VERSION:-latest}
4248
build:
4349
context: .
50+
tags:
51+
- openneuropet/ezbids-handler:latest
52+
- openneuropet/ezbids-handler:${EZBIDS_VERSION:-latest}
4453
dockerfile: handler/Dockerfile
4554
platform: linux/amd64
4655
volumes:
@@ -61,9 +70,13 @@ services:
6170
ui:
6271
# we only run this container to build the UI pages to mount into a volume
6372
# for use in the nginx container.
64-
container_name: brainlife_ezbids-ui-builder
73+
container_name: ezbids-ui-builder
74+
image: openneuropet/ezbids-ui-nginx:${EZBIDS_VERSION:-latest}
6575
build:
6676
context: ./ui/
77+
tags:
78+
- openneuropet/ezbids-ui-nginx:latest
79+
- openneuropet/ezbids-ui-nginx:${EZBIDS_VERSION:-latest}
6780
dockerfile: Dockerfile-production
6881
platform: linux/amd64
6982
environment:
@@ -76,8 +89,12 @@ services:
7689

7790
# by default this is not enabled, add COMPOSE_PROFILES=telemetry to your .env
7891
telemetry:
79-
container_name: brainlife_ezbids-telemetry
80-
build: ./telemetry
92+
container_name: ezbids-telemetry
93+
build:
94+
context: ./telemetry
95+
tags:
96+
- openneuropet/ezbids-telemetry:latest
97+
- openneuropet/ezbids-telemetry:${EZBIDS_VERSION:-latest}
8198
platform: linux/amd64
8299
depends_on:
83100
- mongodb
@@ -86,7 +103,7 @@ services:
86103
- ezbids
87104

88105
nginx:
89-
container_name: brainlife_ezbids-nginx
106+
container_name: ezbids-nginx
90107
depends_on:
91108
- ui
92109
- api

0 commit comments

Comments
 (0)