-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (40 loc) · 1.43 KB
/
deploy.yml
File metadata and controls
49 lines (40 loc) · 1.43 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Deploy to Yandex Cloud
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
# Login to Yandex Cloud
- name: Yandex Cloud Login
uses: yandex-cloud/github-action@v3.0.0
with:
service-account-key: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
# Login to Container Registry
- name: Login to Yandex Container Registry
run: |
yc container registry configure-docker
# Build Docker Image (Force AMD64 architecture)
- name: Build and Push Docker Image
run: |
# Use the Commit Hash as the tag so every build is unique
IMAGE_URL=cr.yandex/${{ secrets.YC_REGISTRY_ID }}/konto-api:${{ github.sha }}
docker build --platform linux/amd64 -t $IMAGE_URL .
docker push $IMAGE_URL
# Save the image URL for the next step
echo "IMAGE_URL=$IMAGE_URL" >> $GITHUB_ENV
# Deploy to Serverless Container
- name: Deploy Revision
run: |
yc serverless container revision deploy \
--container-id ${{ secrets.YC_CONTAINER_ID }} \
--image-url ${{ env.IMAGE_URL }} \
--service-account-id ${{ secrets.YC_SERVICE_ACCOUNT_ID }} \
--cores 1 \
--memory 512M \
--execution-timeout 30s \
--concurrency 4