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

View file

@ -23,12 +23,12 @@ on:
jobs: jobs:
build: 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: with:
repo: erpnext repo: erpnext
version: develop version: develop
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
multiarch: ${{ github.event_name != 'pull_request' }} platforms: "${{ \"['linux/amd64']\" }}"
secrets: secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

View file

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

View file

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

View file

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