Skip to content

Commit 36a8ded

Browse files
feat: add CI for production docker container build (#2728)
1 parent 88ba414 commit 36a8ded

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

.github/helper/apps.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[
2+
{"url": "https://github.com/frappe/erpnext","branch": "version-15"},
3+
{"url": "https://github.com/frappe/payments","branch": "version-15"},
4+
{"url": "https://github.com/frappe/hrms","branch": "version-15"}
5+
]

.github/workflows/build_image.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build Container Image
2+
on:
3+
release:
4+
types: [published]
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- version-15
9+
tags:
10+
- "*"
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
arch: [amd64, arm64]
19+
20+
permissions:
21+
packages: write
22+
23+
steps:
24+
- name: Checkout Entire Repository
25+
uses: actions/checkout@v4
26+
27+
- name: Set up QEMU
28+
uses: docker/setup-qemu-action@v3
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
with:
33+
platforms: linux/${{ matrix.arch }}
34+
- name: Login to GitHub Container Registry
35+
uses: docker/login-action@v2
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Set Branch
42+
run: |
43+
export APPS_JSON_PATH='${{ github.workspace }}/.github/helper/apps.json'
44+
echo "APPS_JSON_BASE64=$(cat $APPS_JSON_PATH | base64 -w 0)" >> $GITHUB_ENV
45+
echo "FRAPPE_BRANCH=version-15" >> $GITHUB_ENV
46+
47+
- name: Set Image Tag
48+
run: |
49+
echo "IMAGE_TAG=stable" >> $GITHUB_ENV
50+
- uses: actions/checkout@v4
51+
with:
52+
repository: frappe/frappe_docker
53+
path: builds
54+
55+
- name: Build and push
56+
uses: docker/build-push-action@v6
57+
with:
58+
push: true
59+
context: builds
60+
file: builds/images/layered/Containerfile
61+
tags: >
62+
ghcr.io/${{ github.repository }}:${{ github.ref_name }},
63+
ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
64+
build-args: |
65+
"FRAPPE_BRANCH=${{ env.FRAPPE_BRANCH }}"
66+
"APPS_JSON_BASE64=${{ env.APPS_JSON_BASE64 }}"

0 commit comments

Comments
 (0)