Skip to content

Commit ee25edc

Browse files
ebrains ci jobs
1 parent b9beeef commit ee25edc

File tree

3 files changed

+120
-2
lines changed

3 files changed

+120
-2
lines changed

.github/workflows/ebrains.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Mirror to Ebrains
2+
3+
on:
4+
push:
5+
branches: [master]
6+
tags:
7+
- "*"
8+
9+
jobs:
10+
to_ebrains:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: syncmaster
14+
uses: wei/git-sync@v3
15+
with:
16+
source_repo: "Medical-Informatics-Platform/platform-ui"
17+
source_branch: "master"
18+
destination_repo: "https://ghpusher:${{ secrets.EBRAINS_GITLAB_ACCESS_TOKEN }}@gitlab.ebrains.eu/hbp-mip/platform-ui.git"
19+
destination_branch: "master"
20+
- name: synctags
21+
uses: wei/git-sync@v3
22+
with:
23+
source_repo: "Medical-Informatics-Platform/platform-ui"
24+
source_branch: "refs/tags/*"
25+
destination_repo: "https://ghpusher:${{ secrets.EBRAINS_GITLAB_ACCESS_TOKEN }}@gitlab.ebrains.eu/hbp-mip/platform-ui.git"
26+
destination_branch: "refs/tags/*"
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Publish images
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
HARBOR_REGISTRY: docker-registry.ebrains.eu
9+
DOCKER_BUILDKIT: 1
10+
DOCKER_CLIENT_TIMEOUT: 300
11+
COMPOSE_HTTP_TIMEOUT: 300
12+
RETRY_ATTEMPTS: "4"
13+
RETRY_SLEEP: "10"
14+
15+
jobs:
16+
build_and_push_ui:
17+
name: Build PLATFORM-UI image and push to registries
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Check out repository
22+
uses: actions/checkout@v6
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Harbor connectivity probe
28+
run: |
29+
set -x
30+
getent hosts ${{ env.HARBOR_REGISTRY }} || true
31+
curl -vI --connect-timeout 10 https://${{ env.HARBOR_REGISTRY }}/v2/ || true
32+
33+
- name: Disable IPv6 (job-scoped)
34+
run: |
35+
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
36+
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
37+
38+
- name: Log in to Docker Hub
39+
uses: docker/login-action@v3
40+
with:
41+
username: ${{ secrets.DOCKER_USERNAME }}
42+
password: ${{ secrets.DOCKER_PASSWORD }}
43+
44+
- name: Log in to EBRAINS HARBOR (retry)
45+
run: |
46+
for i in $(seq 1 ${{ env.RETRY_ATTEMPTS }}); do
47+
echo "${{ secrets.HARBOR_PASSWORD }}" | \
48+
docker login ${{ env.HARBOR_REGISTRY }} \
49+
-u "${{ secrets.HARBOR_USERNAME }}" --password-stdin && exit 0
50+
echo "Harbor login attempt $i failed; retrying in ${{ env.RETRY_SLEEP }}s..."
51+
sleep ${{ env.RETRY_SLEEP }}
52+
done
53+
echo "Harbor login failed after ${{ env.RETRY_ATTEMPTS }} attempts" >&2
54+
exit 1
55+
56+
- name: Extract metadata (tags, labels) for Docker
57+
id: meta
58+
uses: docker/metadata-action@v5
59+
with:
60+
images: |
61+
hbpmip/platform-ui
62+
${{ env.HARBOR_REGISTRY }}/medical-informatics-platform/platform-ui
63+
64+
- name: Load PLATFORM-UI service cached image
65+
uses: actions/cache@v5
66+
with:
67+
path: /tmp/.buildx-cache/platform-ui
68+
key: ${{ runner.os }}-buildx-platform-ui-${{ hashFiles('Dockerfile', 'nginx.conf.template', 'package.json', 'package-lock.json', 'angular.json', 'src/**', 'public/**') }}
69+
restore-keys: |
70+
${{ runner.os }}-buildx-platform-ui-
71+
72+
- name: Build PLATFORM-UI docker image
73+
uses: docker/build-push-action@v6
74+
with:
75+
context: .
76+
file: ./Dockerfile
77+
push: true
78+
tags: ${{ steps.meta.outputs.tags }}
79+
labels: ${{ steps.meta.outputs.labels }}
80+
cache-from: type=local,src=/tmp/.buildx-cache/platform-ui
81+
cache-to: type=local,dest=/tmp/.buildx-cache-new/platform-ui
82+
83+
- name: Move Docker images cache
84+
run: |
85+
rm -rf /tmp/.buildx-cache
86+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@ FROM node:20-alpine AS build
33
WORKDIR /app
44

55
# Install dependencies with cache mount for npm cache
6-
COPY package.json package-lock.json ./
6+
# Some branches intentionally do not track package-lock.json.
7+
# Copy whichever npm manifest files exist and install accordingly.
8+
COPY package*.json ./
79
RUN npm config set fetch-retries 10 \
810
&& npm config set fetch-retry-mintimeout 30000 \
911
&& npm config set fetch-retry-maxtimeout 300000
1012

1113
RUN --mount=type=cache,target=/root/.npm \
12-
npm ci --legacy-peer-deps --no-audit --no-fund --registry=https://registry.npmjs.org/
14+
if [ -f package-lock.json ]; then \
15+
npm ci --legacy-peer-deps --no-audit --no-fund --registry=https://registry.npmjs.org/; \
16+
else \
17+
npm install --legacy-peer-deps --no-audit --no-fund --registry=https://registry.npmjs.org/; \
18+
fi
1319

1420

1521
# Copy source code

0 commit comments

Comments
 (0)