-
Notifications
You must be signed in to change notification settings - Fork 25
75 lines (68 loc) · 2.68 KB
/
build_and_push_images.yaml
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
# https://docs.github.com/en/actions/using-workflows/reusing-workflows
name: Build and Push Container Images
on:
workflow_call:
inputs:
tag:
required: true
type: string
env:
GHCR_REGISTRY: ghcr.io/${{ github.repository_owner }}
DOCKER_HUB_REGISTRY: docker.io/tricorderobservability
jobs:
build-and-push-images:
name: Build and Push Container Images
runs-on: ubuntu-latest
container:
image: docker.io/tricorderobservability/ci_image:202303180311
timeout-minutes: 90
permissions:
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Login to GitHub Package Registry
uses: docker/login-action@v2.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v2.1.0
with:
registry: docker.io
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- uses: bazelbuild/setup-bazelisk@v2
- name: Build and push starship api-server image to Github Packages
run: |
.github/scripts/bazel.sh run --define=TAG=${{ inputs.tag }} --define=REGISTRY=${GHCR_REGISTRY} //src/api-server/cmd:push_api-server_image
.github/scripts/bazel.sh run --define=TAG=${{ inputs.tag }} --define=REGISTRY=${DOCKER_HUB_REGISTRY} //src/api-server/cmd:push_api-server_image
.github/scripts/bazel.sh run --define=TAG=${{ inputs.tag }} --define=REGISTRY=${GHCR_REGISTRY} //src/agent/cmd:push_agent_image
.github/scripts/bazel.sh run --define=TAG=${{ inputs.tag }} --define=REGISTRY=${DOCKER_HUB_REGISTRY} //src/agent/cmd:push_agent_image
# Below are for building and pushing mgmt-ui image
- name: Set Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Run yarn install
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command
dir: "ui"
- name: Build production bundle
uses: borales/actions-yarn@v4
with:
cmd: run build # will run `yarn run build` command
dir: "ui"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push GitHub package registry
uses: docker/build-push-action@v4
with:
push: true
file: ./ui/docker/Dockerfile
context: ./ui
tags: ${{ env.GHCR_REGISTRY }}/mgmt-ui:${{ inputs.tag }},${{ env.DOCKER_HUB_REGISTRY }}/mgmt-ui:${{ inputs.tag }}