2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-09 14:50:58 +00:00

Build ERPNext images on top fresh Frappe images (#582)

Update build_stable.yml
This commit is contained in:
Lev 2021-11-24 02:40:27 +03:00 committed by GitHub
parent d049e33b40
commit 5aae67117c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 154 additions and 103 deletions

View File

@ -55,15 +55,22 @@ jobs:
targets: bench-build
push: true
build_frappe:
name: Frappe
build_main:
name: Frappe & ERPNext
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host
- name: Login
uses: docker/login-action@v1
@ -72,56 +79,37 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
- name: Build Frappe
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: frappe-develop-test
load: true
- name: Test
run: ./tests/test-frappe.sh
- name: Push
if: env.IS_AUTHORIZED_RUN == 'true'
- name: Push Frappe to local registry
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: frappe-develop
targets: frappe-develop-test-local
push: true
build_erpnext:
name: ERPNext
runs-on: ubuntu-latest
needs: build_frappe
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Test Frappe
run: ./tests/test-frappe.sh
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
- name: Login
uses: docker/login-action@v1
if: env.IS_AUTHORIZED_RUN == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
- name: Build ERPNext
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: erpnext-develop-test
load: true
- name: Test
run: FRAPPE_VERSION=develop ./tests/test-erpnext.sh
- name: Test ERPNext
run: ./tests/test-erpnext.sh
- name: Push
if: env.IS_AUTHORIZED_RUN == 'true'
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: erpnext-develop
targets: frappe-develop,erpnext-develop
push: true

View File

@ -35,19 +35,25 @@ env:
IS_AUTHORIZED_RUN: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
jobs:
build_frappe:
name: Frappe
build:
name: Frappe & ERPNext
runs-on: ubuntu-latest
strategy:
matrix:
version: [12, 13]
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host
- name: Login
uses: docker/login-action@v1
@ -61,14 +67,36 @@ jobs:
env:
VERSION: ${{ matrix.version }}
- name: Build
- name: Build Frappe
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: frappe-stable-test
load: true
- name: Push
- name: Push Frappe to local registry
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: frappe-stable-test-local
push: true
- name: Test Frappe
if: github.event_name == 'pull_request'
run: ./tests/test-frappe.sh
- name: Build ERPNext
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: erpnext-stable-test
load: true
- name: Test ERPNext
if: github.event_name == 'pull_request'
run: ./tests/test-erpnext.sh
- name: Push Frappe
if: env.IS_AUTHORIZED_RUN == 'true'
uses: docker/bake-action@v1.6.0
with:
@ -78,41 +106,7 @@ jobs:
env:
GIT_TAG: ${{ env.FRAPPE_VERSION }}
build_erpnext:
name: ERPNext
runs-on: ubuntu-latest
needs: build_frappe
strategy:
matrix:
version: [12, 13]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
- name: Login
uses: docker/login-action@v1
if: env.IS_AUTHORIZED_RUN == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get latest versions
run: ./.github/scripts/get-latest-tags.sh
env:
VERSION: ${{ matrix.version }}
- name: Build
uses: docker/bake-action@v1.6.0
with:
files: docker-bake.hcl
targets: erpnext-stable-test
load: true
- name: Push
- name: Push ERPNext
if: env.IS_AUTHORIZED_RUN == 'true'
uses: docker/bake-action@v1.6.0
with:
@ -126,7 +120,7 @@ jobs:
name: Release Helm
runs-on: ubuntu-latest
if: github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request'
needs: [build_frappe, build_erpnext]
needs: build
steps:
- name: Setup deploy key

View File

@ -1,4 +1,8 @@
# Images
# Docker Buildx Bake build definition file
# Reference: https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md
# Bench images
target "bench-build" {
tags = ["frappe/bench:latest"]
@ -11,6 +15,9 @@ target "bench-test" {
target = "test"
}
# Main images
# Base for all other targets
target "frappe-nginx" {
dockerfile = "build/frappe-nginx/Dockerfile"
}
@ -41,35 +48,51 @@ target "develop-args" {
}
}
variable "GIT_TAG" {}
variable "GIT_BRANCH" {}
variable "VERSION" {}
target "stable-args" {
args = {
GIT_BRANCH = "${GIT_BRANCH}"
IMAGE_TAG = "${GIT_BRANCH}"
PYTHON_VERSION = "${VERSION}" == "12" ? "3.7" : "3.9"
}
}
function "set_develop_tags" {
params = [repo]
result = ["${repo}:latest", "${repo}:edge", "${repo}:develop"]
}
# NOTE: Variable are used only for stable builds
variable "GIT_TAG" {} # git tag, e.g. v13.15.0
variable "GIT_BRANCH" {} # git branch, e.g. version-13
variable "VERSION" {} # Frappe and ERPNext version, e.g. 13
target "stable-args" {
args = {
GIT_BRANCH = "${GIT_BRANCH}"
IMAGE_TAG = "${GIT_BRANCH}"
# ERPNext build fails on v12
# TODO: Remove PYTHON_VERSION argument when v12 will stop being supported
PYTHON_VERSION = "${VERSION}" == "12" ? "3.7" : "3.9"
}
}
function "set_stable_tags" {
# e.g. base_image:v13.15.0, base_image:v13, base_image:version-13
params = [repo]
result = ["${repo}:${GIT_TAG}", "${repo}:v${VERSION}", "${repo}:${GIT_BRANCH}"]
}
target "test-erpnext-args" {
args = {
IMAGE_TAG = "test"
DOCKER_REGISTRY_PREFIX = "localhost:5000/frappe"
}
}
function "set_local_test_tags" {
params = [repo]
result = ["localhost:5000/${repo}:test"]
}
function "set_test_tags" {
params = [repo]
result = ["${repo}:test"]
}
# Develop
# Develop images
target "frappe-nginx-develop" {
inherits = ["frappe-nginx", "develop-args"]
@ -104,7 +127,22 @@ group "erpnext-develop" {
targets = ["erpnext-nginx-develop", "erpnext-worker-develop"]
}
# Develop test
# Test develop images
target "frappe-nginx-develop-test-local" {
inherits = ["frappe-nginx-develop"]
tags = set_local_test_tags("frappe/frappe-nginx")
}
target "frappe-worker-develop-test-local" {
inherits = ["frappe-worker-develop"]
tags = set_local_test_tags("frappe/frappe-worker")
}
target "frappe-socketio-develop-test-local" {
inherits = ["frappe-socketio-develop"]
tags = set_local_test_tags("frappe/frappe-socketio")
}
target "frappe-nginx-develop-test" {
inherits = ["frappe-nginx-develop"]
@ -122,15 +160,19 @@ target "frappe-socketio-develop-test" {
}
target "erpnext-nginx-develop-test" {
inherits = ["erpnext-nginx-develop"]
inherits = ["erpnext-nginx-develop", "test-erpnext-args"]
tags = set_test_tags("frappe/erpnext-nginx")
}
target "erpnext-worker-develop-test" {
inherits = ["erpnext-worker-develop"]
inherits = ["erpnext-worker-develop", "test-erpnext-args"]
tags = set_test_tags("frappe/erpnext-worker")
}
group "frappe-develop-test-local" {
targets = ["frappe-nginx-develop-test-local", "frappe-worker-develop-test-local", "frappe-socketio-develop-test-local"]
}
group "frappe-develop-test" {
targets = ["frappe-nginx-develop-test", "frappe-worker-develop-test", "frappe-socketio-develop-test"]
}
@ -140,7 +182,7 @@ group "erpnext-develop-test" {
}
# Stable
# Stable images
target "frappe-nginx-stable" {
inherits = ["frappe-nginx", "stable-args"]
@ -175,7 +217,23 @@ group "erpnext-stable" {
targets = ["erpnext-nginx-stable", "erpnext-worker-stable"]
}
# Stable test
# Test stable images
target "frappe-nginx-stable-test-local" {
inherits = ["frappe-nginx-stable"]
tags = set_local_test_tags("frappe/frappe-nginx")
}
target "frappe-worker-stable-test-local" {
inherits = ["frappe-worker-stable"]
tags = set_local_test_tags("frappe/frappe-worker")
}
target "frappe-socketio-stable-test-local" {
inherits = ["frappe-socketio-stable"]
tags = set_local_test_tags("frappe/frappe-socketio")
}
target "frappe-nginx-stable-test" {
inherits = ["frappe-nginx-stable"]
tags = set_test_tags("frappe/frappe-nginx")
@ -192,15 +250,19 @@ target "frappe-socketio-stable-test" {
}
target "erpnext-nginx-stable-test" {
inherits = ["erpnext-nginx-stable"]
inherits = ["erpnext-nginx-stable", "test-erpnext-args"]
tags = set_test_tags("frappe/erpnext-nginx")
}
target "erpnext-worker-stable-test" {
inherits = ["erpnext-worker-stable"]
inherits = ["erpnext-worker-stable", "test-erpnext-args"]
tags = set_test_tags("frappe/erpnext-worker")
}
group "frappe-stable-test-local" {
targets = ["frappe-nginx-stable-test-local", "frappe-worker-stable-test-local", "frappe-socketio-stable-test-local"]
}
group "frappe-stable-test" {
targets = ["frappe-nginx-stable-test", "frappe-worker-stable-test", "frappe-socketio-stable-test"]
}

View File

@ -9,14 +9,12 @@ SITE_NAME="test_erpnext.localhost"
echo ::group::Setup env
cp env-example .env
sed -i -e "s/FRAPPE_VERSION=edge/FRAPPE_VERSION=$FRAPPE_VERSION/g" .env
sed -i -e "s/ERPNEXT_VERSION=edge/ERPNEXT_VERSION=test/g" .env
sed -i -e "s/edge/test/g" .env
# shellcheck disable=SC2046
export $(cat .env)
cat .env
print_group Start services
FRAPPE_VERSION=$FRAPPE_VERSION ERPNEXT_VERSION="test" \
docker-compose \
-p $project_name \
-f installation/docker-compose-common.yml \
@ -24,6 +22,7 @@ FRAPPE_VERSION=$FRAPPE_VERSION ERPNEXT_VERSION="test" \
-f installation/erpnext-publish.yml \
up -d
print_group Fix permissions
docker run \
--rm \
--user root \

View File

@ -7,6 +7,16 @@ source tests/functions.sh
project_name="test_frappe"
SITE_NAME="test_frappe.localhost"
docker_compose_with_args() {
# shellcheck disable=SC2068
docker-compose \
-p $project_name \
-f installation/docker-compose-common.yml \
-f installation/docker-compose-frappe.yml \
-f installation/frappe-publish.yml \
$@
}
echo ::group::Setup env
cp env-example .env
sed -i -e "s/edge/test/g" .env
@ -15,13 +25,7 @@ export $(cat .env)
cat .env
print_group Start services
FRAPPE_VERSION="test" \
docker-compose \
-p $project_name \
-f installation/docker-compose-common.yml \
-f installation/docker-compose-frappe.yml \
-f installation/frappe-publish.yml \
up -d
docker_compose_with_args up -d
print_group Create site
docker run \
@ -32,4 +36,8 @@ docker run \
frappe/frappe-worker:test new
ping_site
print_group Stop and remove containers
docker_compose_with_args down
rm .env