-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (100 loc) · 3.28 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
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
100
101
102
103
104
105
106
107
108
109
110
name: Build test project
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
REGISTRY: ghcr.io
# IMAGE_NAME: ${{ github.repository }}
IMAGE_NAME: meow
jobs:
init:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
target:
- go_builder
steps:
- uses: actions/checkout@v4
- name: Preparing builder - ${{ matrix.target }}
run: |
docker build -f ./base.Dockerfile \
-t base:${{ matrix.target }} \
--target ${{ matrix.target }} \
.
- name: Log into registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u "${{ github.actor }}" --password-stdin
- uses: actions/checkout@v4
- name: Start build pingserver
run: |
docker images
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME-pingserver
echo IMAGE_ID=$IMAGE_ID
docker build -f ./apps/pingserver/Dockerfile \
--tag $IMAGE_NAME \
.
docker tag $IMAGE_NAME $IMAGE_ID:latest
docker push $IMAGE_ID:latest
# backend:
# runs-on: ubuntu-latest
# needs:
# - init
# strategy:
# matrix:
# target:
# - pingserver
# steps:
# - name: Log into registry
# run: |
# echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u "${{ github.actor }}" --password-stdin
# - uses: actions/checkout@v4
# - name: Start build ${{ matrix.target }}
# run: |
# docker images
#
# IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME-${{ matrix.target }}
# echo IMAGE_ID=$IMAGE_ID
#
# docker build -f ./apps/${{ matrix.target }}/Dockerfile \
# --tag $IMAGE_NAME \
# .
#
# docker tag $IMAGE_NAME $IMAGE_ID:latest
# docker push $IMAGE_ID:latest
# -t ${{ github.actor }}/testci-${{ matrix.target }}:latest .
# --cache-from type=gha,scope=twir-base:${{ matrix.target }} \
# --cache-to type=gha,mode=max,scope=twir-base:${{ matrix.target }} \
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v4
# - name: Log in to the Container registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# - name: Build and push Docker image PING
# uses: docker/build-push-action@v5
# with:
# context: apps/pingserver
# file: apps/pingserver/base.Dockerfile
# push: true
# tags: ${{ steps.meta.outputs.tags }}-pingpong
# labels: ${{ steps.meta.outputs.labels }}
# - name: Build and push Docker image HI
# uses: docker/build-push-action@v5
# with:
# context: apps/hiserver
# push: true
# tags: ${{ steps.meta.outputs.tags }}-hiserver
# labels: ${{ steps.meta.outputs.labels }}