-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (80 loc) · 3.37 KB
/
build-docker-containers.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Build Docker Containers Workflow
on:
workflow_dispatch:
inputs:
build_web:
description: 'Build and push Web'
required: false
default: true
type: boolean
build_api:
description: 'Build and push API'
required: false
default: true
type: boolean
build_cli:
description: 'Build and push CLI'
required: false
default: true
type: boolean
jobs:
build-and-push-web:
if: ${{ github.event.inputs.build_web == 'true' }}
name: Build and Push Web
runs-on: ubuntu-latest
steps:
- name: Git - Checkout
uses: actions/checkout@v2
- name: Prepare environment variables
run: |
echo "app_name=moaitime-web" >> "$GITHUB_ENV"
echo "app_folder=web" >> "$GITHUB_ENV"
echo "app_build_path=." >> "$GITHUB_ENV"
- name: Docker - Build
run: docker build --tag ${{ env.app_name }} --file ./apps/${{ env.app_folder }}/Dockerfile ${{ env.app_build_path }}
- name: Docker - Login
run: docker login docker.pkg.github.com --username $GITHUB_ACTOR --password ${{ secrets.GITHUB_TOKEN }}
- name: Docker - Tag
run: docker tag ${{ env.app_name }} docker.pkg.github.com/${{ github.repository }}/${{ env.app_name }}:latest
- name: Docker - Push
run: docker push docker.pkg.github.com/${{ github.repository }}/${{ env.app_name }}:latest
build-and-push-api:
if: ${{ github.event.inputs.build_api == 'true' }}
name: Build and Push API
runs-on: ubuntu-latest
steps:
- name: Git - Checkout
uses: actions/checkout@v2
- name: Prepare environment variables
run: |
echo "app_name=moaitime-api" >> "$GITHUB_ENV"
echo "app_folder=api" >> "$GITHUB_ENV"
echo "app_build_path=." >> "$GITHUB_ENV"
- name: Docker - Build
run: docker build --tag ${{ env.app_name }} --file ./apps/${{ env.app_folder }}/Dockerfile ${{ env.app_build_path }}
- name: Docker - Login
run: docker login docker.pkg.github.com --username $GITHUB_ACTOR --password ${{ secrets.GITHUB_TOKEN }}
- name: Docker - Tag
run: docker tag ${{ env.app_name }} docker.pkg.github.com/${{ github.repository }}/${{ env.app_name }}:latest
- name: Docker - Push
run: docker push docker.pkg.github.com/${{ github.repository }}/${{ env.app_name }}:latest
build-and-push-cli:
if: ${{ github.event.inputs.build_cli == 'true' }}
name: Build and Push CLI
runs-on: ubuntu-latest
steps:
- name: Git - Checkout
uses: actions/checkout@v2
- name: Prepare environment variables
run: |
echo "app_name=moaitime-cli" >> "$GITHUB_ENV"
echo "app_folder=cli" >> "$GITHUB_ENV"
echo "app_build_path=." >> "$GITHUB_ENV"
- name: Docker - Build
run: docker build --tag ${{ env.app_name }} --file ./apps/${{ env.app_folder }}/Dockerfile ${{ env.app_build_path }}
- name: Docker - Login
run: docker login docker.pkg.github.com --username $GITHUB_ACTOR --password ${{ secrets.GITHUB_TOKEN }}
- name: Docker - Tag
run: docker tag ${{ env.app_name }} docker.pkg.github.com/${{ github.repository }}/${{ env.app_name }}:latest
- name: Docker - Push
run: docker push docker.pkg.github.com/${{ github.repository }}/${{ env.app_name }}:latest