This repository has been archived by the owner on Mar 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
109 lines (93 loc) · 2.79 KB
/
pi0neerpat-packages.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
name: 'pi0neerpat-packages'
on:
push:
# Only run on these branches
branches:
- pi0neerpat-packages
paths:
# Implementation specific
- '.github/workflows/pi0neerpat-packages.yml'
- 'docker/pi0neerpat-packages/**'
# Redwood specific
- 'api/**'
- 'web/**'
- 'graphql.config.js'
- 'package.json'
- 'redwood.toml'
- 'yarn.lock'
# Generic
- '.yarn/releases/**'
env:
# Environment variable
NODE_ENV: 'development'
RUNTIME_ENV: 'dev'
# Container Registry
IMAGE_PREFIX: pi0neerpat-packages
jobs:
#
# Build
#
build:
name: Build
runs-on: ubuntu-20.04
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
platform: [api, web]
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Setup Docker
uses: docker/setup-buildx-action@v2
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
- name: Docker build
uses: docker/build-push-action@v4
with:
push: true
context: .
file: ./docker/${{ env.IMAGE_PREFIX }}/${{ matrix.platform }}/Dockerfile
build-args: |
NODE_ENV=${{ env.NODE_ENV }}
RUNTIME_ENV=${{ env.RUNTIME_ENV }}
tags: |
ghcr.io/${{ github.repository_owner }}/docker-${{ env.IMAGE_PREFIX }}-${{ matrix.platform }}-${{ env.RUNTIME_ENV }}:latest
ghcr.io/${{ github.repository_owner }}/docker-${{ env.IMAGE_PREFIX }}-${{ matrix.platform }}-${{ env.RUNTIME_ENV }}:${{ github.sha }}
#
# Analyse
#
analyze:
name: Analyse
needs: [build]
runs-on: ubuntu-20.04
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
platform: [api, web]
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Setup Docker
uses: docker/setup-buildx-action@v2
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
- name: Install dependencies
run: |
wget https://github.com/wagoodman/dive/releases/download/v0.9.2/dive_0.9.2_linux_amd64.deb
sudo apt install ./dive_0.9.2_linux_amd64.deb
- name: Run Dive
run: |
CI=true dive ghcr.io/${{ github.repository_owner }}/docker-${{ env.IMAGE_PREFIX }}-${{ matrix.platform }}-${{ env.RUNTIME_ENV }}:${{ github.sha }}
- name: Image size
run: |
docker images | egrep '^.*SIZE|docker\-.*'