mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-17 05:45:09 +00:00
feat(ci): split core image workflows and publish base images to ghcr
This commit is contained in:
parent
28dbfd57ba
commit
0281722f75
11 changed files with 232 additions and 75 deletions
10
.github/scripts/get_latest_tags.py
vendored
10
.github/scripts/get_latest_tags.py
vendored
|
|
@ -49,6 +49,13 @@ def update_env(file_name: str, frappe_tag: str, erpnext_tag: str | None = None):
|
||||||
f.write(text)
|
f.write(text)
|
||||||
|
|
||||||
|
|
||||||
|
def update_output(file_name: str, frappe_tag: str, erpnext_tag: str | None = None):
|
||||||
|
with open(file_name, "a", encoding="utf-8") as f:
|
||||||
|
f.write(f"frappe_version={frappe_tag}\n")
|
||||||
|
if erpnext_tag:
|
||||||
|
f.write(f"erpnext_version={erpnext_tag}\n")
|
||||||
|
|
||||||
|
|
||||||
def _print_resp(frappe_tag: str, erpnext_tag: str | None = None):
|
def _print_resp(frappe_tag: str, erpnext_tag: str | None = None):
|
||||||
print(json.dumps({"frappe": frappe_tag, "erpnext": erpnext_tag}))
|
print(json.dumps({"frappe": frappe_tag, "erpnext": erpnext_tag}))
|
||||||
|
|
||||||
|
|
@ -70,6 +77,9 @@ def main(_args: list[str]) -> int:
|
||||||
file_name = os.getenv("GITHUB_ENV")
|
file_name = os.getenv("GITHUB_ENV")
|
||||||
if file_name:
|
if file_name:
|
||||||
update_env(file_name, frappe_tag, erpnext_tag)
|
update_env(file_name, frappe_tag, erpnext_tag)
|
||||||
|
file_name = os.getenv("GITHUB_OUTPUT")
|
||||||
|
if file_name:
|
||||||
|
update_output(file_name, frappe_tag, erpnext_tag)
|
||||||
_print_resp(frappe_tag, erpnext_tag)
|
_print_resp(frappe_tag, erpnext_tag)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
|
||||||
33
.github/workflows/build_develop.yml
vendored
33
.github/workflows/build_develop.yml
vendored
|
|
@ -1,33 +0,0 @@
|
||||||
name: Develop build
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- images/production/**
|
|
||||||
- overrides/**
|
|
||||||
- tests/**
|
|
||||||
- compose.yaml
|
|
||||||
- docker-bake.hcl
|
|
||||||
- example.env
|
|
||||||
- .github/workflows/build_develop.yml
|
|
||||||
|
|
||||||
schedule:
|
|
||||||
# Every day at 12:00 pm
|
|
||||||
- cron: 0 0 * * *
|
|
||||||
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
uses: ./.github/workflows/docker-build-push.yml
|
|
||||||
with:
|
|
||||||
repo: erpnext
|
|
||||||
version: develop
|
|
||||||
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
|
||||||
python_version: 3.14.2
|
|
||||||
node_version: 24.12.0
|
|
||||||
secrets:
|
|
||||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
name: Bench
|
name: Core / Build Bench
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
@ -7,7 +7,7 @@ on:
|
||||||
paths:
|
paths:
|
||||||
- images/bench/**
|
- images/bench/**
|
||||||
- docker-bake.hcl
|
- docker-bake.hcl
|
||||||
- .github/workflows/build_bench.yml
|
- .github/workflows/core-build-bench.yml
|
||||||
|
|
||||||
schedule:
|
schedule:
|
||||||
# Every day at 12:00 pm
|
# Every day at 12:00 pm
|
||||||
49
.github/workflows/core-build-develop.yml
vendored
Normal file
49
.github/workflows/core-build-develop.yml
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
name: Core / Build Develop
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- images/production/**
|
||||||
|
- overrides/**
|
||||||
|
- tests/**
|
||||||
|
- compose.yaml
|
||||||
|
- docker-bake.hcl
|
||||||
|
- example.env
|
||||||
|
- .github/workflows/core-build-develop.yml
|
||||||
|
- .github/workflows/core-build-test-images.yml
|
||||||
|
- .github/workflows/core-publish-images.yml
|
||||||
|
|
||||||
|
schedule:
|
||||||
|
# Every day at 12:00 pm
|
||||||
|
- cron: 0 0 * * *
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
uses: ./.github/workflows/core-build-test-images.yml
|
||||||
|
with:
|
||||||
|
repo: erpnext
|
||||||
|
version: develop
|
||||||
|
python_version: 3.14.2
|
||||||
|
node_version: 24.12.0
|
||||||
|
|
||||||
|
publish:
|
||||||
|
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
||||||
|
needs: test
|
||||||
|
uses: ./.github/workflows/core-publish-images.yml
|
||||||
|
with:
|
||||||
|
repo: erpnext
|
||||||
|
frappe_version: ${{ needs.test.outputs.frappe_version }}
|
||||||
|
erpnext_version: ${{ needs.test.outputs.erpnext_version }}
|
||||||
|
python_version: 3.14.2
|
||||||
|
node_version: 24.12.0
|
||||||
|
secrets:
|
||||||
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
name: Stable build
|
name: Core / Build Stable
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
@ -11,7 +15,9 @@ on:
|
||||||
- compose.yaml
|
- compose.yaml
|
||||||
- docker-bake.hcl
|
- docker-bake.hcl
|
||||||
- example.env
|
- example.env
|
||||||
- .github/workflows/build_stable.yml
|
- .github/workflows/core-build-stable.yml
|
||||||
|
- .github/workflows/core-build-test-images.yml
|
||||||
|
- .github/workflows/core-publish-images.yml
|
||||||
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
|
@ -23,6 +29,9 @@ on:
|
||||||
- compose.yaml
|
- compose.yaml
|
||||||
- docker-bake.hcl
|
- docker-bake.hcl
|
||||||
- example.env
|
- example.env
|
||||||
|
- .github/workflows/core-build-stable.yml
|
||||||
|
- .github/workflows/core-build-test-images.yml
|
||||||
|
- .github/workflows/core-publish-images.yml
|
||||||
|
|
||||||
# Triggered from frappe/frappe and frappe/erpnext on releases
|
# Triggered from frappe/frappe and frappe/erpnext on releases
|
||||||
repository_dispatch:
|
repository_dispatch:
|
||||||
|
|
@ -30,24 +39,43 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
v15:
|
v15_test:
|
||||||
uses: ./.github/workflows/docker-build-push.yml
|
uses: ./.github/workflows/core-build-test-images.yml
|
||||||
with:
|
with:
|
||||||
repo: erpnext
|
repo: erpnext
|
||||||
version: "15"
|
version: "15"
|
||||||
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
python_version: 3.11.6
|
||||||
|
node_version: 20.19.2
|
||||||
|
|
||||||
|
v15_publish:
|
||||||
|
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
||||||
|
needs: v15_test
|
||||||
|
uses: ./.github/workflows/core-publish-images.yml
|
||||||
|
with:
|
||||||
|
repo: erpnext
|
||||||
|
frappe_version: ${{ needs.v15_test.outputs.frappe_version }}
|
||||||
|
erpnext_version: ${{ needs.v15_test.outputs.erpnext_version }}
|
||||||
python_version: 3.11.6
|
python_version: 3.11.6
|
||||||
node_version: 20.19.2
|
node_version: 20.19.2
|
||||||
secrets:
|
secrets:
|
||||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
v16:
|
v16_test:
|
||||||
uses: ./.github/workflows/docker-build-push.yml
|
uses: ./.github/workflows/core-build-test-images.yml
|
||||||
with:
|
with:
|
||||||
repo: erpnext
|
repo: erpnext
|
||||||
version: "16"
|
version: "16"
|
||||||
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
python_version: 3.14.2
|
||||||
|
node_version: 24.12.0
|
||||||
|
v16_publish:
|
||||||
|
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
||||||
|
needs: v16_test
|
||||||
|
uses: ./.github/workflows/core-publish-images.yml
|
||||||
|
with:
|
||||||
|
repo: erpnext
|
||||||
|
frappe_version: ${{ needs.v16_test.outputs.frappe_version }}
|
||||||
|
erpnext_version: ${{ needs.v16_test.outputs.erpnext_version }}
|
||||||
python_version: 3.14.2
|
python_version: 3.14.2
|
||||||
node_version: 24.12.0
|
node_version: 24.12.0
|
||||||
secrets:
|
secrets:
|
||||||
|
|
@ -58,7 +86,7 @@ jobs:
|
||||||
name: Update example.env and pwd.yml
|
name: Update example.env and pwd.yml
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
||||||
needs: v16
|
needs: v16_publish
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
@ -96,7 +124,7 @@ jobs:
|
||||||
name: Release Helm
|
name: Release Helm
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
||||||
needs: v16
|
needs: v16_publish
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Setup deploy key
|
- name: Setup deploy key
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
name: Build
|
name: Core / Build and Test Images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
@ -11,9 +11,6 @@ on:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
description: "Major version, git tags should match 'v{version}.*'; or 'develop'"
|
description: "Major version, git tags should match 'v{version}.*'; or 'develop'"
|
||||||
push:
|
|
||||||
required: true
|
|
||||||
type: boolean
|
|
||||||
python_version:
|
python_version:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
|
@ -22,16 +19,36 @@ on:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
description: NodeJS Version
|
description: NodeJS Version
|
||||||
secrets:
|
outputs:
|
||||||
DOCKERHUB_USERNAME:
|
frappe_version:
|
||||||
required: true
|
description: "Resolved frappe image tag"
|
||||||
DOCKERHUB_TOKEN:
|
value: ${{ jobs.resolve.outputs.frappe_version }}
|
||||||
required: true
|
erpnext_version:
|
||||||
|
description: "Resolved erpnext image tag"
|
||||||
|
value: ${{ jobs.resolve.outputs.erpnext_version }}
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
resolve:
|
||||||
|
name: Resolve Versions
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
frappe_version: ${{ steps.resolve.outputs.frappe_version }}
|
||||||
|
erpnext_version: ${{ steps.resolve.outputs.erpnext_version }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Resolve image versions
|
||||||
|
id: resolve
|
||||||
|
run: python3 ./.github/scripts/get_latest_tags.py --repo ${{ inputs.repo }} --version ${{ inputs.version }}
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: resolve
|
||||||
services:
|
services:
|
||||||
registry:
|
registry:
|
||||||
image: docker.io/registry:2
|
image: docker.io/registry:2
|
||||||
|
|
@ -57,8 +74,12 @@ jobs:
|
||||||
driver-opts: network=host
|
driver-opts: network=host
|
||||||
platforms: linux/${{ matrix.arch }}
|
platforms: linux/${{ matrix.arch }}
|
||||||
|
|
||||||
- name: Get latest versions
|
- name: Set resolved versions
|
||||||
run: python3 ./.github/scripts/get_latest_tags.py --repo ${{ inputs.repo }} --version ${{ inputs.version }}
|
run: |
|
||||||
|
echo "FRAPPE_VERSION=${{ needs.resolve.outputs.frappe_version }}" >> "$GITHUB_ENV"
|
||||||
|
if [ -n "${{ needs.resolve.outputs.erpnext_version }}" ]; then
|
||||||
|
echo "ERPNEXT_VERSION=${{ needs.resolve.outputs.erpnext_version }}" >> "$GITHUB_ENV"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Set build args
|
- name: Set build args
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -85,17 +106,3 @@ jobs:
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: venv/bin/pytest --color=yes
|
run: venv/bin/pytest --color=yes
|
||||||
|
|
||||||
- name: Login
|
|
||||||
if: ${{ inputs.push }}
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Push
|
|
||||||
if: ${{ inputs.push }}
|
|
||||||
uses: docker/bake-action@v7.1.0
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
set: "*.platform=linux/amd64,linux/arm64"
|
|
||||||
92
.github/workflows/core-publish-images.yml
vendored
Normal file
92
.github/workflows/core-publish-images.yml
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
name: Core / Publish Images
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
repo:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
description: "'erpnext' or 'frappe'"
|
||||||
|
frappe_version:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
description: "Resolved frappe image tag"
|
||||||
|
erpnext_version:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
description: "Resolved erpnext image tag"
|
||||||
|
python_version:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
description: Python Version
|
||||||
|
node_version:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
description: NodeJS Version
|
||||||
|
secrets:
|
||||||
|
DOCKERHUB_USERNAME:
|
||||||
|
required: true
|
||||||
|
DOCKERHUB_TOKEN:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
name: Publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Setup QEMU
|
||||||
|
uses: docker/setup-qemu-action@v4
|
||||||
|
with:
|
||||||
|
image: tonistiigi/binfmt:latest
|
||||||
|
platforms: all
|
||||||
|
|
||||||
|
- name: Setup Buildx
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
|
- name: Set resolved versions
|
||||||
|
run: |
|
||||||
|
echo "FRAPPE_VERSION=${{ inputs.frappe_version }}" >> "$GITHUB_ENV"
|
||||||
|
if [ -n "${{ inputs.erpnext_version }}" ]; then
|
||||||
|
echo "ERPNEXT_VERSION=${{ inputs.erpnext_version }}" >> "$GITHUB_ENV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Set build args
|
||||||
|
run: |
|
||||||
|
echo "PYTHON_VERSION=${{ inputs.python_version }}" >> "$GITHUB_ENV"
|
||||||
|
echo "NODE_VERSION=${{ inputs.node_version }}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Push Docker Hub images
|
||||||
|
uses: docker/bake-action@v7.1.0
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
set: "*.platform=linux/amd64,linux/arm64"
|
||||||
|
|
||||||
|
- name: Login to GHCR
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Push GHCR base images
|
||||||
|
uses: docker/bake-action@v7.1.0
|
||||||
|
with:
|
||||||
|
targets: base-images
|
||||||
|
push: true
|
||||||
|
set: "*.platform=linux/amd64,linux/arm64"
|
||||||
|
env:
|
||||||
|
REGISTRY_USER: ghcr.io/${{ github.repository_owner }}
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
name: Deploy Frappe Docker Docs to GitHub Pages
|
name: Docs / Publish Site
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths:
|
paths:
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
- ".github/workflows/publish_docs.yml"
|
- ".github/workflows/docs-publish-site.yml"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
|
|
@ -143,4 +143,4 @@ In case of new release of Debian. e.g. bullseye to bookworm. Change following fi
|
||||||
|
|
||||||
Change following files on release of ERPNext
|
Change following files on release of ERPNext
|
||||||
|
|
||||||
- `.github/workflows/build_stable.yml`: Add the new release step under `jobs` and remove the unmaintained one. e.g. In case v12, v13 available, v14 will be added and v12 will be removed on release of v14. Also change the `needs:` for later steps to `v14` from `v13`.
|
- `.github/workflows/core-build-stable.yml`: Add the new release step under `jobs` and remove the unmaintained one. e.g. In case v12, v13 available, v14 will be added and v12 will be removed on release of v14. Also change the `needs:` for later steps to `v14` from `v13`.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Frappe Docker
|
# Frappe Docker
|
||||||
|
|
||||||
[](https://github.com/frappe/frappe_docker/actions/workflows/build_stable.yml)
|
[](https://github.com/frappe/frappe_docker/actions/workflows/core-build-stable.yml)
|
||||||
[](https://github.com/frappe/frappe_docker/actions/workflows/build_develop.yml)
|
[](https://github.com/frappe/frappe_docker/actions/workflows/core-build-develop.yml)
|
||||||
|
|
||||||
Docker images and orchestration for Frappe applications.
|
Docker images and orchestration for Frappe applications.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,10 @@ group "default" {
|
||||||
targets = ["erpnext", "base", "build"]
|
targets = ["erpnext", "base", "build"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
group "base-images" {
|
||||||
|
targets = ["base", "build"]
|
||||||
|
}
|
||||||
|
|
||||||
function "tag" {
|
function "tag" {
|
||||||
params = [repo, version]
|
params = [repo, version]
|
||||||
result = [
|
result = [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue