refactor to explicit platform list

This commit is contained in:
Al Majumdar 2022-04-02 22:22:20 +05:30
parent 61443ea472
commit e769bbb5ad
5 changed files with 13 additions and 14 deletions

View file

@ -35,8 +35,7 @@ jobs:
uses: docker/bake-action@v1.7.0
with:
targets: bench-test
env:
MULTI_ARCH_BUILD: ${{ github.event_name != 'pull_request' }}
set: "*.platform=${{ github.event_name != 'pull_request' ? \"['linux/amd64','linux/arm64']\" : \"['linux/amd64']\" }}"
- name: Login
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}

View file

@ -23,12 +23,12 @@ on:
jobs:
build:
uses: frappe/frappe_docker/.github/workflows/docker-build-push.yml@main
uses: restlessronin/frappe_docker/.github/workflows/docker-build-push.yml@images-for-m1-mac
with:
repo: erpnext
version: develop
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
multiarch: ${{ github.event_name != 'pull_request' }}
platforms: "${{ \"['linux/amd64']\" }}"
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

View file

@ -40,7 +40,7 @@ jobs:
repo: erpnext
version: "13"
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
multiarch: false
platforms: "['linux/amd64']"
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
@ -51,7 +51,7 @@ jobs:
repo: erpnext
version: "13"
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
multiarch: false
platforms: "['linux/amd64']"
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

View file

@ -14,10 +14,10 @@ on:
push:
required: true
type: boolean
multiarch:
platforms:
required: true
type: boolean
description: "toggle for multi arch build"
type: string
description: "list of target platforms"
secrets:
DOCKERHUB_USERNAME:
required: true
@ -56,9 +56,9 @@ jobs:
uses: docker/bake-action@v1.7.0
with:
push: true
set: "*.platform=${{ inputs.platforms }}"
env:
REGISTRY_USER: localhost:5000/frappe
MULTI_ARCH_BUILD: ${{ inputs.multiarch }}
- name: Setup Python
uses: actions/setup-python@v3

View file

@ -13,8 +13,8 @@ variable "ERPNEXT_VERSION" {
default = "develop"
}
variable "MULTI_ARCH_BUILD" {
default = false
variable "ARCH_PLATFORMS" {
default = "local"
}
# Bench image
@ -23,7 +23,7 @@ target "bench" {
context = "images/bench"
target = "bench"
tags = ["frappe/bench:latest"]
platforms = equal(true, "${MULTI_ARCH_BUILD}") ? ["linux/amd64","linux/arm64"] : ["linux/amd64"]
platforms = "${ARCH_PLATFORMS}"
}
target "bench-test" {
@ -63,7 +63,7 @@ target "default-args" {
# If `ERPNEXT_VERSION` variable contains "v12" use Python 3.7. Else  3.9.
PYTHON_VERSION = can(regex("v12", "${ERPNEXT_VERSION}")) ? "3.7" : "3.9"
}
platforms = equal(true, "${MULTI_ARCH_BUILD}") ? ["linux/amd64","linux/arm64"] : ["linux/amd64"]
platforms = "${ARCH_PLATFORMS}"
}
target "frappe-worker" {