-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
30 lines (26 loc) · 1.07 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
default:
image: docker
services:
- docker:dind
variables:
IMAGE_REF_NAME: eu.gcr.io/$GCLOUD_PROJECT_ID/khaomanee:$CI_COMMIT_REF_SLUG
GCLOUD_SERVICE_KEY_PATH: /tmp/$CI_PIPELINE_ID.json
GCLOUD_RUN_REGION: asia-southeast1
GCLOUD_RUN_SERVICE: khaomanee
stages:
- deploy
deploy:
stage: deploy
only:
- main
after_script:
- rm -f $GCLOUD_SERVICE_KEY_PATH
script:
- apk add --update python3
- wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz -O - | tar -zx
- google-cloud-sdk/install.sh -q --usage-reporting=false --additional-components beta
- echo $GCLOUD_SERVICE_KEY > $GCLOUD_SERVICE_KEY_PATH
- google-cloud-sdk/bin/gcloud -q auth activate-service-account --key-file $GCLOUD_SERVICE_KEY_PATH
- google-cloud-sdk/bin/gcloud -q config set project $GCLOUD_PROJECT_ID
- google-cloud-sdk/bin/gcloud builds submit --tag $IMAGE_REF_NAME
- google-cloud-sdk/bin/gcloud -q beta run deploy $GCLOUD_RUN_SERVICE --platform=managed --image=$IMAGE_REF_NAME --region=$GCLOUD_RUN_REGION --memory=1024Mi --allow-unauthenticated