2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-12-23 18:48:58 +00:00

Merge pull request #403 from frappe/revert-402-arm64

Revert "feat: make images arm64 compatible"
This commit is contained in:
Revant Nandgaonkar 2021-01-07 19:44:54 +05:30 committed by GitHub
commit 823f960364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 188 additions and 262 deletions

View File

@ -11,28 +11,14 @@ services:
- docker
before_install:
# Install latest docker (https://www.docker.com/blog/multi-arch-build-what-about-travis)
- sudo rm -rf /var/lib/apt/lists/*
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge"
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
- mkdir -vp ~/.docker/cli-plugins/
- curl --silent -L "https://github.com/docker/buildx/releases/download/v0.5.1/buildx-v0.5.1.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx
- docker buildx create --use
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- docker buildx inspect --bootstrap
- if [[ "$BUILD" != "development" ]]; then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin;
sudo apt-get update && sudo apt-get -y install git;
fi
- if [[ $BUILD == "development" ]];then
sudo apt-get update && sudo apt-get -y install curl;
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose;
sudo chmod +x /usr/local/bin/docker-compose;
sudo apt-get update && sudo apt-get -y install docker-compose;
fi
- chmod u+x ./travis.py
after_success:
- docker --version
@ -42,244 +28,128 @@ jobs:
- stage: "Build Frappe bench development environment (latest)"
if: branch = develop AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/bench:latest
-f build/bench/Dockerfile .
- stage: "Frappe Worker (edge)"
- docker build -t frappe/bench:latest -f build/bench/Dockerfile .
- docker push frappe/bench:latest
- stage: "Frappe (edge)"
if: branch = develop AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:edge
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:develop
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:latest
-f build/frappe-worker/Dockerfile .
- stage: "Frappe Nginx (edge)"
- ./travis.py frappe --worker --tag latest
- ./travis.py frappe --worker --tag edge --tag-only
- ./travis.py frappe --worker --tag develop --tag-only
- stage: "Frappe (edge)"
if: branch = develop AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:edge
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:develop
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:latest
-f build/frappe-nginx/Dockerfile .
- stage: "Frappe SocketIO (edge)"
- ./travis.py frappe --nginx --tag latest
- ./travis.py frappe --nginx --tag edge --tag-only
- ./travis.py frappe --nginx --tag develop --tag-only
- stage: "Frappe (edge)"
if: branch = develop AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:edge
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:develop
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:latest
-f build/frappe-socketio/Dockerfile .
- stage: "ERPNext Worker (edge)"
- ./travis.py frappe --socketio --tag latest
- ./travis.py frappe --socketio --tag edge --tag-only
- ./travis.py frappe --socketio --tag develop --tag-only
- stage: "ERPNext (edge)"
if: branch = develop AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:edge
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:develop
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:latest
-f build/erpnext-worker/Dockerfile .
- stage: "ERPNext Nginx (edge)"
- ./travis.py erpnext --worker --tag latest
- ./travis.py erpnext --worker --tag edge --tag-only
- ./travis.py erpnext --worker --tag develop --tag-only
- stage: "ERPNext (edge)"
if: branch = develop AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:edge
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:develop
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:latest
-f build/erpnext-nginx/Dockerfile .
- stage: "Frappe Worker (v13-beta)"
- ./travis.py erpnext --nginx --tag latest
- ./travis.py erpnext --nginx --tag edge --tag-only
- ./travis.py erpnext --nginx --tag develop --tag-only
- stage: "Frappe (v13-beta)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-13-beta
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:v13
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:${VERSION}
-f build/frappe-worker/Dockerfile .
- stage: "Frappe Nginx (v13-beta)"
- ./travis.py frappe --worker --git-version 13-beta
- ./travis.py frappe --worker --tag v13-beta --tag-only
- ./travis.py frappe --worker --tag version-13-beta --tag-only
- stage: "Frappe (v13-beta)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--no-cache
--build-arg GIT_BRANCH=version-13-beta
--platform linux/amd64,linux/arm64
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:v13
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:${VERSION}
-f build/frappe-nginx/Dockerfile .
- stage: "Frappe SocketIO (v13-beta)"
- ./travis.py frappe --nginx --git-version 13-beta
- ./travis.py frappe --nginx --tag v13-beta --tag-only
- ./travis.py frappe --nginx --tag version-13-beta --tag-only
- stage: "Frappe (v13-beta)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-13-beta
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:v13
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:${VERSION}
-f build/frappe-socketio/Dockerfile .
- stage: "ERPNext Worker (v13-beta)"
- ./travis.py frappe --socketio --git-version 13-beta
- ./travis.py frappe --socketio --tag v13-beta --tag-only
- ./travis.py frappe --socketio --tag version-13-beta --tag-only
- stage: "ERPNext (v13-beta)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-13-beta
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:v13
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:${VERSION}
-f build/erpnext-worker/Dockerfile .
- stage: "ERPNext Nginx (v13-beta)"
- ./travis.py erpnext --worker --git-version 13-beta
- ./travis.py erpnext --worker --tag v13-beta --tag-only
- ./travis.py erpnext --worker --tag version-13-beta --tag-only
- stage: "ERPNext (v13-beta)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-13-beta
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:v13
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:${VERSION}
-f build/erpnext-nginx/Dockerfile .
- stage: "Frappe Worker (v12)"
- ./travis.py erpnext --nginx --git-version 13-beta
- ./travis.py erpnext --nginx --tag v13-beta --tag-only
- ./travis.py erpnext --nginx --tag version-13-beta --tag-only
- stage: "Frappe (v12)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-12
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:v12
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:${VERSION}
-f build/frappe-worker/Dockerfile .
- stage: "Frappe Nginx (v12)"
- ./travis.py frappe --worker --git-version 12
- ./travis.py frappe --worker --tag v12 --tag-only
- ./travis.py frappe --worker --tag version-12 --tag-only
- stage: "Frappe (v12)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--no-cache
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-12
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:v12
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:${VERSION}
-f build/frappe-nginx/Dockerfile .
- stage: "Frappe SocketIO (v12)"
- ./travis.py frappe --nginx --git-version 12
- ./travis.py frappe --nginx --tag v12 --tag-only
- ./travis.py frappe --nginx --tag version-12 --tag-only
- stage: "Frappe (v12)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-12
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:v12
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:${VERSION}
-f build/frappe-socketio/Dockerfile .
- stage: "ERPNext Worker (v12)"
- ./travis.py frappe --socketio --git-version 12
- ./travis.py frappe --socketio --tag v12 --tag-only
- ./travis.py frappe --socketio --tag version-12 --tag-only
- stage: "ERPNext (v12)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-12
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:v12
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:${VERSION}
-f build/erpnext-worker/Dockerfile .
- stage: "ERPNext Nginx (v12)"
- ./travis.py erpnext --worker --git-version 12
- ./travis.py erpnext --worker --tag v12 --tag-only
- ./travis.py erpnext --worker --tag version-12 --tag-only
- stage: "ERPNext (v12)"
if: branch = master AND type != pull_request
script:
- docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-12
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:v12
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:${VERSION}
-f build/erpnext-nginx/Dockerfile .
- stage: "Frappe Worker (v11)"
- ./travis.py erpnext --nginx --git-version 12
- ./travis.py erpnext --nginx --tag v12 --tag-only
- ./travis.py erpnext --nginx --tag version-12 --tag-only
- stage: "Frappe (v11)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-11
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:v11
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:${VERSION}
-f build/frappe-worker/Dockerfile .
- stage: "Frappe Nginx (v11)"
- ./travis.py frappe --worker --git-version 11
- ./travis.py frappe --worker --tag v11 --tag-only
- ./travis.py frappe --worker --tag version-11 --tag-only
- stage: "Frappe (v11)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--no-cache
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-11
--build-arg NODE_IMAGE_TAG=10-buster-slim
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:v11
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:${VERSION}
-f build/frappe-nginx/Dockerfile .
- stage: "Frappe SocketIO (v11)"
- ./travis.py frappe --nginx --git-version 11
- ./travis.py frappe --nginx --tag v11 --tag-only
- ./travis.py frappe --nginx --tag version-11 --tag-only
- stage: "Frappe (v11)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-11
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:v11
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:${VERSION}
-f build/frappe-socketio/Dockerfile .
- stage: "ERPNext Worker (v11)"
- ./travis.py frappe --socketio --git-version 11
- ./travis.py frappe --socketio --tag v11 --tag-only
- ./travis.py frappe --socketio --tag version-11 --tag-only
- stage: "ERPNext (v11)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-11
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:v11
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:${VERSION}
-f build/erpnext-worker/Dockerfile .
- stage: "ERPNext Nginx (v11)"
- ./travis.py erpnext --worker --git-version 11
- ./travis.py erpnext --worker --tag v11 --tag-only
- ./travis.py erpnext --worker --tag version-11 --tag-only
- stage: "ERPNext (v11)"
if: branch = master AND type != pull_request
script:
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-11
--build-arg NODE_IMAGE_TAG=10-buster-slim
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:v11
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:${VERSION}
-f build/erpnext-nginx/Dockerfile .
- ./travis.py erpnext --nginx --git-version 11
- ./travis.py erpnext --nginx --tag v11 --tag-only
- ./travis.py erpnext --nginx --tag version-11 --tag-only
- stage: "Build and test edge images"
if: type = pull_request
before_install:

View File

@ -1,8 +1,8 @@
# Frappe Bench Dockerfile
FROM debian:buster-slim
FROM bitnami/minideb:latest
LABEL author=frappé
RUN apt-get update -y && apt-get install \
RUN install_packages \
git \
wkhtmltopdf \
mariadb-client \
@ -49,18 +49,14 @@ RUN apt-get update -y && apt-get install \
python3-setuptools \
python3-tk \
python-virtualenv \
less -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
less
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
# Detect arch, download and install wkhtmltox
RUN if [ `uname -m` = 'aarch64' ]; then export ARCH=arm64; fi \
&& if [ `uname -m` = 'x86_64' ]; then export ARCH=amd64; fi \
&& wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_${ARCH}.deb \
&& dpkg -i wkhtmltox_0.12.6-1.buster_${ARCH}.deb && rm wkhtmltox_0.12.6-1.buster_${ARCH}.deb
# Install wkhtmltox correctly
RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb
RUN dpkg -i wkhtmltox_0.12.5-1.buster_amd64.deb && rm wkhtmltox_0.12.5-1.buster_amd64.deb
# Create new user with home directory, improve docker compatibility with UID/GID 1000, add user to sudo group, allow passwordless sudo, switch to that user and change directory to user home directory
RUN groupadd -g 1000 frappe
@ -93,7 +89,7 @@ ENV NODE_VERSION=12.20.0
ENV NODE_VERSION_FRAPPEV11=10.23.0
# Install nvm with node
RUN wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh
RUN wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh
RUN chmod +x install.sh
RUN ./install.sh
ENV NVM_DIR=/home/frappe/.nvm

View File

@ -1,19 +1,13 @@
ARG NODE_IMAGE_TAG=12-buster-slim
ARG NODE_IMAGE_TAG=12-prod
ARG GIT_BRANCH=develop
ARG DOCKER_REGISTRY_PREFIX=frappe
FROM node:${NODE_IMAGE_TAG}
FROM bitnami/node:${NODE_IMAGE_TAG}
ARG GIT_BRANCH
COPY build/erpnext-nginx/install_app.sh /install_app
RUN chmod +x /install_app && \
apt-get update -y && \
apt-get install build-essential git python2 -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN /install_app erpnext https://github.com/frappe/erpnext ${GIT_BRANCH}
FROM ${DOCKER_REGISTRY_PREFIX}/frappe-nginx:${GIT_BRANCH}
FROM frappe/frappe-nginx:${GIT_BRANCH}
COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/
COPY --from=0 /rsync /rsync

View File

@ -10,6 +10,8 @@ mkdir -p /home/frappe/frappe-bench/sites/assets
cd /home/frappe/frappe-bench
echo -e "frappe\n${APP_NAME}" > /home/frappe/frappe-bench/sites/apps.txt
install_packages git python2
mkdir -p apps
cd apps
git clone --depth 1 https://github.com/frappe/frappe ${BRANCH}
@ -18,6 +20,7 @@ git clone --depth 1 ${APP_REPO} ${BRANCH} ${APP_NAME}
cd /home/frappe/frappe-bench/apps/frappe
yarn
yarn production --app ${APP_NAME}
rm -fr node_modules
yarn install --production=true
yarn add node-sass

View File

@ -1,6 +1,5 @@
ARG GIT_BRANCH=develop
ARG DOCKER_REGISTRY_PREFIX=frappe
FROM ${DOCKER_REGISTRY_PREFIX}/frappe-worker:${GIT_BRANCH}
FROM frappe/frappe-worker:${GIT_BRANCH}
ARG GIT_BRANCH
RUN install_app erpnext https://github.com/frappe/erpnext ${GIT_BRANCH}

View File

@ -2,16 +2,13 @@
# This is done to ensures that node-sass binary remains common.
# node-sass is required to enable website theme feature used
# by Website Manager role in Frappe Framework
FROM python:3.7-slim-buster
FROM bitnami/python:3.7-prod
ENV NVM_DIR=/root/.nvm
ENV NODE_VERSION=12.20.0
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN apt-get update -y \
&& apt-get install wget python2 git build-essential -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh \
RUN install_packages wget \
&& wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh \
&& chmod +x install.sh \
&& ./install.sh \
&& . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} \
@ -21,6 +18,8 @@ WORKDIR /home/frappe/frappe-bench
RUN mkdir -p /home/frappe/frappe-bench/sites \
&& echo "frappe" > /home/frappe/frappe-bench/sites/apps.txt
RUN install_packages git
ARG GIT_BRANCH=develop
RUN mkdir -p apps sites/assets/css \
&& cd apps \
@ -29,6 +28,7 @@ RUN mkdir -p apps sites/assets/css \
RUN cd /home/frappe/frappe-bench/apps/frappe \
&& yarn \
&& yarn run production \
&& rm -fr node_modules \
&& yarn install --production=true
RUN node --version \

View File

@ -1,4 +1,4 @@
FROM node:buster-slim
FROM node:slim
# Add frappe user
RUN useradd -ms /bin/bash frappe

View File

@ -1,10 +1,11 @@
FROM python:3.7-slim-buster
FROM bitnami/python:3.7-prod
# Add non root user without password
RUN useradd -ms /bin/bash frappe
RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS -1/' /etc/login.defs \
&& sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS -1/' /etc/login.defs \
&& useradd -ms /bin/bash frappe
ARG GIT_BRANCH=develop
ARG ARCH=amd64
ENV PYTHONUNBUFFERED 1
ENV NVM_DIR=/home/frappe/.nvm
ENV NODE_VERSION=12.20.0
@ -12,38 +13,29 @@ ENV PATH="/home/frappe/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
# Install dependencies
WORKDIR /home/frappe/frappe-bench
RUN apt-get update -y && apt-get install \
RUN install_packages \
git \
mariadb-client \
postgresql-client \
gettext-base \
wget \
# for PDF
fonts-cantarell \
libffi-dev \
libjpeg-dev \
libjpeg62-turbo \
libx11-6 \
libxcb1 \
libxext6 \
libx11-6 \
libxml2 \
libxrender1 \
libssl-dev \
fonts-cantarell \
xfonts-75dpi \
xfonts-base \
zlib1g-dev \
# For psycopg2
libpq-dev \
wait-for-it \
# For arm64
gcc \
g++ -y \
# Detect arch, download and install wkhtmltox
&& if [ `uname -m` = 'aarch64' ]; then export ARCH=arm64; fi \
&& if [ `uname -m` = 'x86_64' ]; then export ARCH=amd64; fi \
&& wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_${ARCH}.deb \
&& dpkg -i wkhtmltox_0.12.6-1.buster_${ARCH}.deb && rm wkhtmltox_0.12.6-1.buster_${ARCH}.deb \
&& wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh \
&& wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb \
&& dpkg -i wkhtmltox_0.12.5-1.buster_amd64.deb && rm wkhtmltox_0.12.5-1.buster_amd64.deb \
&& wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh \
&& apt-get purge -y wget && apt-get autoremove -y \
&& chown -R frappe:frappe /home/frappe
USER frappe

72
travis.py Executable file
View File

@ -0,0 +1,72 @@
#!/usr/bin/env python3
import argparse
import subprocess
import os
def parse_args():
parser = argparse.ArgumentParser(description='frappe_docker common CI elements', add_help=True)
parser.add_argument('service', action='store', type=str, help='Name of the service to build: "erpnext" or "frappe"')
parser.add_argument('-o', '--tag-only', required=False, action='store_true', dest='tag_only', help='Only tag an image and push it.')
image_type = parser.add_mutually_exclusive_group(required=True)
image_type.add_argument('-a', '--nginx', action='store_const', dest='image_type', const='nginx', help='Build the nginx + static assets image')
image_type.add_argument('-s', '--socketio', action='store_const', dest='image_type', const='socketio', help='Build the frappe-socketio image')
image_type.add_argument('-w', '--worker', action='store_const', dest='image_type', const='worker', help='Build the python environment image')
tag_type = parser.add_mutually_exclusive_group(required=True)
tag_type.add_argument('-g', '--git-version', action='store', type=str, dest='version', help='The version number of service (i.e. "11", "12", etc.)')
tag_type.add_argument('-t', '--tag', action='store', type=str, dest='tag', help='The image tag (i.e. erpnext-worker:$TAG )')
args = parser.parse_args()
return args
def git_version(service, version, branch):
print(f'Pulling {service} v{version}')
subprocess.run(f'git clone https://github.com/frappe/{service} --branch {branch}', shell=True)
cd = os.getcwd()
os.chdir(os.getcwd() + f'/{service}')
subprocess.run('git fetch --tags', shell=True)
# XX-beta becomes XX for tags search
version = version.split('-')[0]
version_tag = subprocess.check_output(f'git tag --list --sort=-version:refname "v{version}*" | sed -n 1p | sed -e \'s#.*@\(\)#\\1#\'', shell=True).strip().decode('ascii')
os.chdir(cd)
return version_tag
def build(service, tag, image, branch):
build_args = f'--build-arg GIT_BRANCH={branch}'
if service == 'nginx' and branch == 'version-11':
build_args += f' --build-arg NODE_IMAGE_TAG=10-prod'
print(f'Building {service} {image} image')
subprocess.run(f'docker build {build_args} -t {service}-{image} -f build/{service}-{image}/Dockerfile .', shell=True)
tag_and_push(f'{service}-{image}', tag)
def tag_and_push(image_name, tag):
print(f'Tagging {image_name} as "{tag}" and pushing')
subprocess.run(f'docker tag {image_name} frappe/{image_name}:{tag}', shell=True)
subprocess.run(f'docker push frappe/{image_name}:{tag}', shell=True)
def main():
args = parse_args()
tag = args.tag
branch = 'develop'
if args.version:
branch = 'version-' + args.version
tag = git_version(args.service, args.version, branch)
if args.tag_only:
tag_and_push(f'{args.service}-{args.image_type}', tag)
else:
build(args.service, tag, args.image_type, branch)
if __name__ == "__main__":
main()