-
Notifications
You must be signed in to change notification settings - Fork 2
50 lines (46 loc) · 1.57 KB
/
build.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
---
name: build
on:
workflow_call:
secrets:
do-token:
description: 'Digital Ocean access token'
required: true
registry:
description: 'Digital Ocean Container Registry'
required: true
jobs:
build_backend:
runs-on: ubuntu-latest
name: Build backend
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.do-token }}
- name: Build backend
run: |
docker build --build-arg env=prod -t ${{ secrets.registry }}/backend:${{ github.sha }} ./backend
- name: Log in to DigitalOcean Container Registry with short-lived credentials
run: doctl registry login --expiry-seconds 600
- name: Push image to DigitalOcean Container Registry
run: docker push ${{ secrets.registry }}/backend:${{ github.sha }}
build_nginx:
runs-on: ubuntu-latest
name: Build Nginx proxy
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.do-token }}
- name: Build nginx
run: |
docker build --build-arg env=prod -t ${{ secrets.registry }}/nginx:${{ github.sha }} ./nginx
- name: Log in to DigitalOcean Container Registry with short-lived credentials
run: doctl registry login --expiry-seconds 600
- name: Push image to DigitalOcean Container Registry
run: docker push ${{ secrets.registry }}/nginx:${{ github.sha }}