Skip to content

Commit 975eed7

Browse files
Merge pull request #87 from silence-laboratories/CI/CD_test
Ci/cd test
2 parents 43c3902 + b797ef9 commit 975eed7

File tree

6 files changed

+206
-42
lines changed

6 files changed

+206
-42
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Dockerfile
1+
Dockerfile
2+
.github

.github/workflows/build-and-publish-prod.yaml

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,64 @@ on:
88
branches: ['main']
99

1010
jobs:
11-
build:
12-
runs-on: mpc-account-abstraction-sdk-stage-deployer-prod
11+
build-and-push:
12+
runs-on: ubuntu-latest
13+
1314
steps:
14-
- name: Checkout repository
15+
- name: Checkout code
1516
uses: actions/checkout@v4
16-
- name: Install dependencies
17+
18+
- name: Log in to GitHub Container Registry
19+
uses: docker/login-action@v2
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.TOKEN }}
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v2
27+
28+
- name: Set environment files
1729
run: |
18-
npm i
19-
pushd packages/mpc
20-
npm run test
21-
npm run build
22-
popd
23-
pushd packages/biconomy/nextJs
30+
pushd packages/biconomy/nextJs
2431
echo "API_KEY=${{ secrets.BICONOMY_API_KEY }}" >> .env
25-
npm run build
26-
popd
32+
popd
33+
2734
pushd packages/stackup/nextJs
2835
echo "API_KEY=${{ secrets.STACKUP_API_KEY }}" >> .env
29-
npm run build
3036
popd
37+
3138
pushd packages/pimlico/nextJs
3239
echo "API_KEY=${{ secrets.PIMLICO_API_KEY }}" >> .env
33-
npm run build
3440
popd
41+
3542
pushd packages/zerodev/nextJs
3643
echo "API_KEY=${{ secrets.ZERODEV_API_KEY }}" >> .env
37-
npm run build
3844
popd
45+
3946
pushd packages/alchemy/nextJs
4047
echo "API_KEY=${{ secrets.ALCHEMY_API_KEY }}" >> .env
41-
npm run build
4248
popd
43-
if [ -d "/opt/service/mpc-auth-client" ]; then rm -Rf mpc-auth-client; fi
44-
cp -r ../mpc-auth-client /opt/service/
45-
- run: sudo systemctl restart biconomy.service stackup.service pimlico.service zerodev.service alchemy.service
4649
47-
50+
- name: Build and push Docker image
51+
uses: docker/build-push-action@v5
52+
with:
53+
context: .
54+
push: true
55+
tags: |
56+
ghcr.io/silence-laboratories/mpc-auth-client:prod
57+
58+
pull_and_deploy:
59+
runs-on: mpc-account-abstraction-sdk-stage-deployer-prod
60+
needs: build-and-push
61+
steps:
62+
- name: Log in to GitHub Container Registry
63+
uses: docker/login-action@v2
64+
with:
65+
registry: ghcr.io
66+
username: ${{ github.actor }}
67+
password: ${{ secrets.TOKEN }}
68+
- name: Checkout repository
69+
uses: actions/checkout@v4
70+
- run: docker pull ghcr.io/silence-laboratories/mpc-auth-client:prod
71+
- run: docker compose -f compose.yml up -d

.github/workflows/build-and-publish-stage.yaml

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,74 @@ on:
66
workflow_dispatch:
77
pull_request:
88
branches: ['staging']
9-
9+
types:
10+
[opened, closed]
1011
jobs:
11-
build:
12-
runs-on: mpc-account-abstraction-sdk-stage-deployer-asia
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
1315
steps:
14-
- name: Checkout repository
16+
- name: Checkout code
1517
uses: actions/checkout@v4
16-
- name: Install dependencies
18+
19+
- name: Log in to GitHub Container Registry
20+
uses: docker/login-action@v2
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.TOKEN }}
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v2
28+
29+
- name: Set environment files
1730
run: |
18-
npm i
19-
pushd packages/mpc
20-
npm run test
21-
npm run build
22-
popd
23-
pushd packages/biconomy/nextJs
31+
pushd packages/biconomy/nextJs
2432
echo "API_KEY=${{ secrets.BICONOMY_API_KEY }}" >> .env
2533
echo "NEXT_PUBLIC_SDK_MODE=development" >> .env
26-
npm run build
27-
popd
34+
popd
35+
2836
pushd packages/stackup/nextJs
2937
echo "API_KEY=${{ secrets.STACKUP_API_KEY }}" >> .env
3038
echo "NEXT_PUBLIC_SDK_MODE=development" >> .env
31-
npm run build
3239
popd
40+
3341
pushd packages/pimlico/nextJs
3442
echo "API_KEY=${{ secrets.PIMLICO_API_KEY }}" >> .env
3543
echo "NEXT_PUBLIC_SDK_MODE=development" >> .env
36-
npm run build
3744
popd
45+
3846
pushd packages/zerodev/nextJs
3947
echo "API_KEY=${{ secrets.ZERODEV_API_KEY }}" >> .env
4048
echo "NEXT_PUBLIC_SDK_MODE=development" >> .env
41-
npm run build
4249
popd
50+
4351
pushd packages/alchemy/nextJs
4452
echo "API_KEY=${{ secrets.ALCHEMY_API_KEY }}" >> .env
4553
echo "NEXT_PUBLIC_SDK_MODE=development" >> .env
46-
npm run build
4754
popd
48-
if [ -d "/opt/service/mpc-auth-client" ]; then rm -Rf mpc-auth-client; fi
49-
cp -r ../mpc-auth-client /opt/service/
50-
- run: sudo systemctl restart biconomy.service stackup.service pimlico.service zerodev.service alchemy.service
5155
52-
56+
- name: Build and push Docker image
57+
uses: docker/build-push-action@v5
58+
with:
59+
context: .
60+
push: true
61+
tags: |
62+
ghcr.io/silence-laboratories/mpc-auth-client:staging
63+
64+
pull_and_deploy:
65+
runs-on: mpc-account-abstraction-sdk-stage-deployer-asia
66+
needs: build-and-push
67+
steps:
68+
- name: Log in to GitHub Container Registry
69+
uses: docker/login-action@v2
70+
with:
71+
registry: ghcr.io
72+
username: ${{ github.actor }}
73+
password: ${{ secrets.TOKEN }}
74+
- name: Checkout repository
75+
uses: actions/checkout@v4
76+
- run: docker pull ghcr.io/silence-laboratories/mpc-auth-client:staging
77+
- run: docker compose -f compose-stage.yml up -d
78+
79+

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM node:18 as builder
2+
3+
WORKDIR /app
4+
5+
COPY . .
6+
RUN npm install
7+
RUN cd packages/mpc && npm run build && \
8+
cd ../biconomy/nextJs && npm run build && \
9+
cd ../../stackup/nextJs && npm run build && \
10+
cd ../../pimlico/nextJs && npm run build && \
11+
cd ../../zerodev/nextJs && npm run build && \
12+
cd ../../alchemy/nextJs && npm run build
13+
14+
ENV SERVICE_NAME=biconomy
15+
16+
CMD if [ "$SERVICE_NAME" = "biconomy" ]; then \
17+
cd packages/biconomy/nextJs && npm start; \
18+
elif [ "$SERVICE_NAME" = "stackup" ]; then \
19+
cd packages/stackup/nextJs && npm start; \
20+
elif [ "$SERVICE_NAME" = "pimlico" ]; then \
21+
cd packages/pimlico/nextJs && npm start; \
22+
elif [ "$SERVICE_NAME" = "zerodev" ]; then \
23+
cd packages/zerodev/nextJs && npm start; \
24+
elif [ "$SERVICE_NAME" = "alchemy" ]; then \
25+
cd packages/alchemy/nextJs && npm start; \
26+
else \
27+
echo "Unknown service: $SERVICE_NAME"; exit 1; \
28+
fi

compose-stage.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
version: '3.8'
2+
3+
services:
4+
biconomy:
5+
image: ghcr.io/silence-laboratories/mpc-auth-client:staging
6+
container_name: biconomy_service
7+
environment:
8+
- SERVICE_NAME=biconomy
9+
ports:
10+
- "3000:3000"
11+
12+
stackup:
13+
image: ghcr.io/silence-laboratories/mpc-auth-client:staging
14+
container_name: stackup_service
15+
environment:
16+
- SERVICE_NAME=stackup
17+
ports:
18+
- "3001:3000"
19+
20+
pimlico:
21+
image: ghcr.io/silence-laboratories/mpc-auth-client:staging
22+
container_name: pimlico_service
23+
environment:
24+
- SERVICE_NAME=pimlico
25+
ports:
26+
- "3002:3000"
27+
28+
zerodev:
29+
image: ghcr.io/silence-laboratories/mpc-auth-client:staging
30+
container_name: zerodev_service
31+
environment:
32+
- SERVICE_NAME=zerodev
33+
ports:
34+
- "3003:3000"
35+
36+
alchemy:
37+
image: ghcr.io/silence-laboratories/mpc-auth-client:staging
38+
container_name: alchemy_service
39+
environment:
40+
- SERVICE_NAME=alchemy
41+
ports:
42+
- "3004:3000"

compose.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
version: '3.8'
2+
3+
services:
4+
biconomy:
5+
image: ghcr.io/silence-laboratories/mpc-auth-client:prod
6+
container_name: biconomy_service
7+
environment:
8+
- SERVICE_NAME=biconomy
9+
ports:
10+
- "3000:3000"
11+
12+
stackup:
13+
image: ghcr.io/silence-laboratories/mpc-auth-client:prod
14+
container_name: stackup_service
15+
environment:
16+
- SERVICE_NAME=stackup
17+
ports:
18+
- "3001:3000"
19+
20+
pimlico:
21+
image: ghcr.io/silence-laboratories/mpc-auth-client:prod
22+
container_name: pimlico_service
23+
environment:
24+
- SERVICE_NAME=pimlico
25+
ports:
26+
- "3002:3000"
27+
28+
zerodev:
29+
image: ghcr.io/silence-laboratories/mpc-auth-client:prod
30+
container_name: zerodev_service
31+
environment:
32+
- SERVICE_NAME=zerodev
33+
ports:
34+
- "3003:3000"
35+
36+
alchemy:
37+
image: ghcr.io/silence-laboratories/mpc-auth-client:prod
38+
container_name: alchemy_service
39+
environment:
40+
- SERVICE_NAME=alchemy
41+
ports:
42+
- "3004:3000"

0 commit comments

Comments
 (0)