Skip to content

Commit d4c4331

Browse files
committed
update
1 parent 5574b94 commit d4c4331

File tree

7 files changed

+29
-6
lines changed

7 files changed

+29
-6
lines changed

.github/workflows/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ jobs:
6262
- name: Deploy to Cloud Run Backend
6363
id: deploy-cloud-run-back
6464
uses: google-github-actions/deploy-cloudrun@v2
65+
env:
66+
PORT: 4000
6567
with:
6668
service: cloud-run-backend-${{ env.IMAGE_VERSION }}
6769
image: us-central1-docker.pkg.dev/${{ secrets.PROJECT_ID }}/cloud-run/cloud-run-back:${{ env.IMAGE_VERSION }}
@@ -71,6 +73,8 @@ jobs:
7173
- name: Deploy to Cloud Run Frontend
7274
id: deploy-cloud-run-front
7375
uses: google-github-actions/deploy-cloudrun@v2
76+
env:
77+
PORT: 80
7478
with:
7579
service: cloud-run-frontend-${{ env.IMAGE_VERSION }}
7680
image: us-central1-docker.pkg.dev/${{ secrets.PROJECT_ID }}/cloud-run/cloud-run-front:${{ env.IMAGE_VERSION }}

Dockerfile.back

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ RUN npm i
55
RUN npm run build_back
66
WORKDIR /back/build
77
RUN npm i
8-
EXPOSE 8080
8+
EXPOSE 4000
99
CMD ["node", "index.js"]

Dockerfile.front

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ FROM nginx:alpine-slim
1111
COPY --from=builder /front/build /front/build
1212
RUN chmod -R 755 /front/build/.
1313
COPY nginx.conf /etc/nginx/nginx.conf
14-
EXPOSE 8080
14+
EXPOSE 80
1515
CMD ["nginx", "-g", "daemon off;"]

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ gcloud projects add-iam-policy-binding "${PROJECT_ID}" \
2727
- Create a new Workload Identity Pool
2828

2929
```bash
30+
export REPO_OWNER="your-github-username"
31+
export REPO_NAME="your-repo-name"
32+
3033
gcloud iam workload-identity-pools create "github" \
3134
--project="${PROJECT_ID}" \
3235
--location="global" \
@@ -56,3 +59,19 @@ gcloud iam service-accounts add-iam-policy-binding ${SA_EMAIL} \
5659
--role="roles/iam.workloadIdentityUser" \
5760
--member="principalSet://iam.googleapis.com/${WORKLOAD_POOL}/attribute.repository/${REPO_OWNER}/${REPO_NAME}"
5861
```
62+
63+
- Create a new GitHub Secret
64+
65+
```bash
66+
WORKLOAD_IDENTITY_PROVIDER value is the output of the following command
67+
gcloud iam workload-identity-pools providers describe "github-repo-provider" \
68+
--project="${PROJECT_ID}" \
69+
--location="global" \
70+
--workload-identity-pool="github" \
71+
--format="value(name)"
72+
73+
PROJECT_ID value is your project id
74+
75+
SERVICE_ACCOUNT value is the email of the service account
76+
cloud-run-sa@${PROJECT_ID}.iam.gserviceaccount.com
77+
```

back/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ app.get('/api/hello', (_req: Request, res: Response) =>
1111
res.json({ message: 'hello' }),
1212
)
1313

14-
app.listen(8080, () => {
15-
console.info(`🚀 express http server started at http://localhost:${8080}`)
14+
app.listen(4000, () => {
15+
console.info(`🚀 express http server started at http://localhost:${4000}`)
1616
})

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ services:
1212
build:
1313
dockerfile: ./Dockerfile.front
1414
ports:
15-
- '80:80'
15+
- '8080:80'
1616
depends_on:
1717
- backend

nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ http {
88
}
99

1010
server {
11-
listen 8080;
11+
listen 80;
1212
server_name _;
1313
index index.html index.htm;
1414

0 commit comments

Comments
 (0)