-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (48 loc) · 1.77 KB
/
cd.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: customk deploy
on:
push:
branches:
- main
jobs:
push_to_registry:
name: Push to ncp container registry
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Inject .env file
run: echo "${{ secrets.ENV_PROD }}" > ./.env
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to NCP Container Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.NCP_CONTAINER_REGISTRY }}
username: ${{ secrets.NCP_ACCESS_KEY }}
password: ${{ secrets.NCP_SECRET_KEY }}
- name: Build and push app image
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ secrets.NCP_CONTAINER_REGISTRY }}/customk-app:${{ github.run_number }}
${{ secrets.NCP_CONTAINER_REGISTRY }}/customk-app:latest
cache-from: type=registry,ref=${{ secrets.NCP_CONTAINER_REGISTRY }}/customk-app:latest
cache-to: type=inline
- name: Prepare nginx.conf with server_name
run: |
export SERVER_NAME=${{ secrets.SERVER_NAME }}
envsubst '${SERVER_NAME}' < ./nginx/nginx.conf.template > ./nginx/nginx.conf
- name: Build and push nginx image
uses: docker/build-push-action@v3
with:
context: ./nginx
file: ./nginx/Dockerfile
push: true
tags: |
${{ secrets.NCP_CONTAINER_REGISTRY }}/customk-nginx:${{ github.run_number }}
${{ secrets.NCP_CONTAINER_REGISTRY }}/customk-nginx:latest
cache-from: type=registry,ref=${{ secrets.NCP_CONTAINER_REGISTRY }}/customk-nginx:latest
cache-to: type=inline