2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-06-02 16:50:48 +00:00

ci: refactor (#1158)

* ci: refactor

use debian bookworm
use updated wkhtmltopdf
override python and nodejs versions

* ci: fix bench and test

* ci: remove comments from example.env

* docs: add maintenance section
This commit is contained in:
Revant Nandgaonkar 2023-06-26 11:54:37 +05:30 committed by GitHub
parent 2c3a57ae90
commit e6c0e7263b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 58 additions and 15 deletions

View File

@ -31,6 +31,9 @@ jobs:
- name: Setup Buildx - name: Setup Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- name: Set Environment Variables
run: cat example.env | grep -o '^[^#]*' >> "$GITHUB_ENV"
- name: Build and test - name: Build and test
uses: docker/bake-action@v3.1.0 uses: docker/bake-action@v3.1.0
with: with:

View File

@ -36,6 +36,8 @@ 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' }}
python_version: 3.9.17
node_version: 14.21.3
secrets: secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
@ -46,6 +48,8 @@ jobs:
repo: erpnext repo: erpnext
version: "14" version: "14"
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
python_version: 3.10.12
node_version: 16.20.1
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,6 +14,14 @@ on:
push: push:
required: true required: true
type: boolean type: boolean
python_version:
required: true
type: string
description: Python Version
node_version:
required: true
type: string
description: NodeJS Version
secrets: secrets:
DOCKERHUB_USERNAME: DOCKERHUB_USERNAME:
required: true required: true
@ -42,6 +50,11 @@ jobs:
- name: Get latest versions - name: Get latest versions
run: python3 ./.github/scripts/get_latest_tags.py --repo ${{ inputs.repo }} --version ${{ inputs.version }} run: python3 ./.github/scripts/get_latest_tags.py --repo ${{ inputs.repo }} --version ${{ inputs.version }}
- name: Set build args
run: |
echo "PYTHON_VERSION=${{ inputs.python_version }}" >> "$GITHUB_ENV"
echo "NODE_VERSION=${{ inputs.node_version }}" >> "$GITHUB_ENV"
- name: Build - name: Build
uses: docker/bake-action@v3.1.0 uses: docker/bake-action@v3.1.0
with: with:

View File

@ -68,3 +68,14 @@ Place relevant markdown files in the `docs` directory and index them in README.m
# Frappe and ERPNext updates # Frappe and ERPNext updates
Each Frappe/ERPNext release triggers new stable images builds as well as bump to helm chart. Each Frappe/ERPNext release triggers new stable images builds as well as bump to helm chart.
# Maintenance
In case of new release of Debian. e.g. bullseye to bookworm. Change following files:
- `images/erpnext/Containerfile` and `images/custom/Containerfile`: Change the files to use new debian release, make sure new python version tag that is available on new debian release image. e.g. 3.9.9 (bullseye) to 3.9.17 (bookworm) or 3.10.5 (bullseye) to 3.10.12 (bookworm). Make sure apt-get packages and wkhtmltopdf version are also upgraded accordingly.
- `images/bench/Dockerfile`: Change the files to use new debian release. Make sure apt-get packages and wkhtmltopdf version are also upgraded accordingly.
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`.

View File

@ -5,6 +5,13 @@ variable "REGISTRY_USER" {
default = "frappe" default = "frappe"
} }
variable PYTHON_VERSION {
default = "3.11.4"
}
variable NODE_VERSION {
default = "18.16.1"
}
variable "FRAPPE_VERSION" { variable "FRAPPE_VERSION" {
default = "develop" default = "develop"
} }
@ -65,8 +72,8 @@ target "default-args" {
BENCH_REPO = "${BENCH_REPO}" BENCH_REPO = "${BENCH_REPO}"
FRAPPE_BRANCH = "${FRAPPE_VERSION}" FRAPPE_BRANCH = "${FRAPPE_VERSION}"
ERPNEXT_BRANCH = "${ERPNEXT_VERSION}" ERPNEXT_BRANCH = "${ERPNEXT_VERSION}"
PYTHON_VERSION = can(regex("v13", "${ERPNEXT_VERSION}")) ? "3.9.9" : "3.10.5" PYTHON_VERSION = "${PYTHON_VERSION}"
NODE_VERSION = can(regex("v13", "${FRAPPE_VERSION}")) ? "14.19.3" : "16.18.0" NODE_VERSION = "${NODE_VERSION}"
} }
} }

View File

@ -1,4 +1,4 @@
FROM debian:bullseye-slim as bench FROM debian:bookworm-slim as bench
LABEL author=frappé LABEL author=frappé
@ -75,10 +75,11 @@ RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& dpkg-reconfigure --frontend=noninteractive locales && dpkg-reconfigure --frontend=noninteractive locales
# Detect arch and install wkhtmltopdf # Detect arch and install wkhtmltopdf
ENV WKHTMLTOPDF_VERSION 0.12.6-1 ARG WKHTMLTOPDF_VERSION=0.12.6.1-3
ARG WKHTMLTOPDF_DISTRO=bookworm
RUN if [ "$(uname -m)" = "aarch64" ]; then export ARCH=arm64; fi \ RUN if [ "$(uname -m)" = "aarch64" ]; then export ARCH=arm64; fi \
&& if [ "$(uname -m)" = "x86_64" ]; then export ARCH=amd64; fi \ && if [ "$(uname -m)" = "x86_64" ]; then export ARCH=amd64; fi \
&& downloaded_file=wkhtmltox_$WKHTMLTOPDF_VERSION.buster_${ARCH}.deb \ && downloaded_file=wkhtmltox_${WKHTMLTOPDF_VERSION}.${WKHTMLTOPDF_DISTRO}_${ARCH}.deb \
&& wget -q https://github.com/wkhtmltopdf/packaging/releases/download/$WKHTMLTOPDF_VERSION/$downloaded_file \ && wget -q https://github.com/wkhtmltopdf/packaging/releases/download/$WKHTMLTOPDF_VERSION/$downloaded_file \
&& dpkg -i $downloaded_file \ && dpkg -i $downloaded_file \
&& rm $downloaded_file && rm $downloaded_file

View File

@ -1,11 +1,13 @@
ARG PYTHON_VERSION=3.10.5 ARG PYTHON_VERSION=3.11.4
FROM python:${PYTHON_VERSION}-slim-bullseye AS base ARG DEBIAN_BASE=bookworm
FROM python:${PYTHON_VERSION}-slim-${DEBIAN_BASE} AS base
COPY resources/nginx-template.conf /templates/nginx/frappe.conf.template COPY resources/nginx-template.conf /templates/nginx/frappe.conf.template
COPY resources/nginx-entrypoint.sh /usr/local/bin/nginx-entrypoint.sh COPY resources/nginx-entrypoint.sh /usr/local/bin/nginx-entrypoint.sh
ARG WKHTMLTOPDF_VERSION=0.12.6-1 ARG WKHTMLTOPDF_VERSION=0.12.6.1-3
ARG NODE_VERSION=16.18.0 ARG WKHTMLTOPDF_DISTRO=bookworm
ARG NODE_VERSION=18.16.1
ENV NVM_DIR=/home/frappe/.nvm ENV NVM_DIR=/home/frappe/.nvm
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH} ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
@ -47,7 +49,7 @@ RUN useradd -ms /bin/bash frappe \
# Install wkhtmltopdf with patched qt # Install wkhtmltopdf with patched qt
&& if [ "$(uname -m)" = "aarch64" ]; then export ARCH=arm64; fi \ && if [ "$(uname -m)" = "aarch64" ]; then export ARCH=arm64; fi \
&& if [ "$(uname -m)" = "x86_64" ]; then export ARCH=amd64; fi \ && if [ "$(uname -m)" = "x86_64" ]; then export ARCH=amd64; fi \
&& downloaded_file=wkhtmltox_$WKHTMLTOPDF_VERSION.buster_${ARCH}.deb \ && downloaded_file=wkhtmltox_${WKHTMLTOPDF_VERSION}.${WKHTMLTOPDF_DISTRO}_${ARCH}.deb \
&& curl -sLO https://github.com/wkhtmltopdf/packaging/releases/download/$WKHTMLTOPDF_VERSION/$downloaded_file \ && curl -sLO https://github.com/wkhtmltopdf/packaging/releases/download/$WKHTMLTOPDF_VERSION/$downloaded_file \
&& apt-get install -y ./$downloaded_file \ && apt-get install -y ./$downloaded_file \
&& rm $downloaded_file \ && rm $downloaded_file \

View File

@ -1,8 +1,10 @@
ARG PYTHON_VERSION=3.10.5 ARG PYTHON_VERSION=3.11.4
FROM python:${PYTHON_VERSION}-slim-bullseye AS base ARG DEBIAN_BASE=bookworm
FROM python:${PYTHON_VERSION}-slim-${DEBIAN_BASE} AS base
ARG WKHTMLTOPDF_VERSION=0.12.6-1 ARG WKHTMLTOPDF_VERSION=0.12.6.1-3
ARG NODE_VERSION=16.18.0 ARG WKHTMLTOPDF_DISTRO=bookworm
ARG NODE_VERSION=18.16.1
ENV NVM_DIR=/home/frappe/.nvm ENV NVM_DIR=/home/frappe/.nvm
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH} ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
@ -44,7 +46,7 @@ RUN useradd -ms /bin/bash frappe \
# Install wkhtmltopdf with patched qt # Install wkhtmltopdf with patched qt
&& if [ "$(uname -m)" = "aarch64" ]; then export ARCH=arm64; fi \ && if [ "$(uname -m)" = "aarch64" ]; then export ARCH=arm64; fi \
&& if [ "$(uname -m)" = "x86_64" ]; then export ARCH=amd64; fi \ && if [ "$(uname -m)" = "x86_64" ]; then export ARCH=amd64; fi \
&& downloaded_file=wkhtmltox_$WKHTMLTOPDF_VERSION.buster_${ARCH}.deb \ && downloaded_file=wkhtmltox_${WKHTMLTOPDF_VERSION}.${WKHTMLTOPDF_DISTRO}_${ARCH}.deb \
&& curl -sLO https://github.com/wkhtmltopdf/packaging/releases/download/$WKHTMLTOPDF_VERSION/$downloaded_file \ && curl -sLO https://github.com/wkhtmltopdf/packaging/releases/download/$WKHTMLTOPDF_VERSION/$downloaded_file \
&& apt-get install -y ./$downloaded_file \ && apt-get install -y ./$downloaded_file \
&& rm $downloaded_file \ && rm $downloaded_file \