How do I install the human resources module in a Docker setup?

There is no directory or place for apps.json. It needs to be passed as base64 encoded string of json, through container build-arg. You can generate it as a part of your CI run job. You can keep a file in a build repo where the runner job is triggered. You can commit changes to apps.json in this “builder” repo.

The environment variable if found is saved into a file in the build layer of the image.

This file is then used to add apps to bench during bench init

Thank you!

It might sound stupid but how do i do it on prem? I dont have an Ci CD pipline…

My Steps so far:

login to my maschine
login as root
go to /opt/erpnext/
git clone frappe_docker
cp /images/custom/Containerfile Dockerfile
cp pwd.yml compose.yaml
nano compose.yaml
edite the Images to build: ./Dockerfile
save nano
docker compose up

in this Prozess via the compose yaml Docker build me my img and docker compose uses it.

Were in this prozess and how do i crate the json string an were do i have to place it?

this is the inculde but were do Docker look for the APPS_JSON_BASE64 variable? and how do I create the json string on prem?

apps.json includes

ARG APPS_JSON_BASE64
RUN if [ -n “${APPS_JSON_BASE64}” ]; then
mkdir /opt/frappe && echo “${APPS_JSON_BASE64}” | base64 -d > /opt/frappe/apps.json;
fi

Hey @mirrose . Check frappe_docker/docs/custom-apps.md at main · frappe/frappe_docker · GitHub

Execute the first export command to load the text into the APPS_JSON variable. Then echo $APPS_JSON into a file, apps.json:

echo $APPS_JSON > apps.json

After that, you can carefully edit the file to your needs.

Hi @trustedcomputer I’m sorry i still dont get it.

how do i run this comand?

export APPS_JSON=‘[
{
“url”: “example url”,
“branch”: “develop”
},
{
“url”: “example url”,
“branch”: “version-14”
},
{
“url”: “example url”,
“branch”: “main”
}
]’

I tried it via the RUN-arg but docker reported an error because of a { and i cant run it from cli or can i?

=> [internal] load .dockerignore 0.0s
=> => transferring context: 83B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 4.98kB 0.0s
Dockerfile:98

96 | # apps.json includes
97 | RUN export APPS_JSON='[
98 | >>> {
99 | “url”: “exapmle url”,
100 | “branch”: “develop”

ERROR: failed to solve: dockerfile parse error on line 98: unknown instruction: {

Thanks for our’e help and patience :slight_smile:

@mirrose You run these commands in your shell (i.e. bash prompt).

Based on frappe_docker/custom-apps.md at main · frappe/frappe_docker · GitHub I’ll write commands below. Copy-paste them in your terminal window and press enter.

git clone https://github.com/frappe/frappe_docker && cd frappe_docker
export APPS_JSON='[
  {
    "url": "https://github.com/frappe/erpnext",
    "branch": "v14.21.0"
  },
  {
    "url": "https://github.com/frappe/hrms",
    "branch": "v14.2.2"
  }
]'
export APPS_JSON_BASE64=$(echo ${APPS_JSON} | base64 -w 0)
docker build \
  --build-arg=FRAPPE_PATH=https://github.com/frappe/frappe \
  --build-arg=FRAPPE_BRANCH=v14.32.1 \
  --build-arg=PYTHON_VERSION=3.10.5 \
  --build-arg=NODE_VERSION=16.18.0 \
  --build-arg=APPS_JSON_BASE64=$APPS_JSON_BASE64 \
  --tag=custom/hrms:1.0.0 \
  --file=images/custom/Containerfile .

Above command will build image named custom/hrms:1.0.0 with frappe v14.32.1, erpnext v14.21.0, hrms v14.2.2, python 3.10.5, nodejs 16.18.0

You can make changes to the command.

3 Likes

Thank you so mutch fort you’re explanations and patience !

It worked! And with this blueprint i have successfully installed a lot of Apps

hello sir, this method not work for me , I can you help me please?

Hi is there a possibility to inclue a custom pip libray?

I want to install the App FinTS and need to install the Python lib fints, how can i do this?

Thanks a lot!

Hi Imed, can you please describe youre Problem a bit further and show some error Messages?

should get installed through apps.json

unfortunately not… docker Build chrashes whit this Error log:

#0 173.7 WARN: restart failed: Couldn't find supervisorctl in PATH
#0 175.0 Traceback (most recent call last):
#0 175.0   File "/usr/local/lib/python3.10/site-packages/bench/commands/make.py", line 68, in init
#0 175.0     init(
#0 175.0   File "/usr/local/lib/python3.10/site-packages/bench/utils/render.py", line 105, in wrapper_fn
#0 175.0     return fn(*args, **kwargs)
#0 175.0   File "/usr/local/lib/python3.10/site-packages/bench/utils/system.py", line 90, in init
#0 175.0     install_apps_from_path(apps_path, bench_path=path)
#0 175.0   File "/usr/local/lib/python3.10/site-packages/bench/app.py", line 689, in install_apps_from_path
#0 175.0     apps = get_apps_json(path)
#0 175.0   File "/usr/local/lib/python3.10/site-packages/bench/app.py", line 707, in get_apps_json
#0 175.0     return json.load(f)
#0 175.0   File "/usr/local/lib/python3.10/json/__init__.py", line 293, in load
#0 175.0     return loads(fp.read(),
#0 175.0   File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
#0 175.0     return _default_decoder.decode(s)
#0 175.0   File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
#0 175.0     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
#0 175.0   File "/usr/local/lib/python3.10/json/decoder.py", line 353, in raw_decode
#0 175.0     obj, end = self.scan_once(s, idx)
#0 175.0 json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 138 (char 137)
#0 175.0
#0 175.0 ERROR: There was a problem while creating /home/frappe/frappe-bench
#0 175.0 Do you want to rollback these changes? [y/N]: Aborted!
------

i use this Apps json

export APPS_JSON='[
  {
    "url": "https://github.com/frappe/erpnext",
    "branch": "v14.23.0"
  },
  {
    "url": "https://github.com/frappe/hrms",
    "branch": "v14.2.3"
  }
  {
    "url": "https://github.com/jHetzer/erpnextfints",
    "branch": "0.4.1"
  }
]'

I’m sorry i just forgot to type a , after hrms in my app.json command

Hi, i’m new here.
So I can add all modules i want to this commands lines to build the image and get them installed in ERPNEXT at once?

yes.

If you have the repos private you need to pass personal access token or basic auth. e.g.
https://{PAT}@github.com/SomeOrg/custom_app replace PAT with your token or username and password in case of non github basic auth.

Ok thanks I want to install Accounting and Hrms module i need their repositories

Check reply #17 How do I install the human resources module in a Docker setup? - #17 by revant_one

Accounting is part of ERPNext v14

Ok whats the next process when the command has finished to create the image @ custom/hrms:1.0.0 ?

use the image and start containers

read everything here frappe_docker/custom-apps.md at main · frappe/frappe_docker · GitHub

This is what it return when i pull the image

(HTTP code 404) unexpected - pull access denied for custom/hrms, repository does not exist or may require ‘docker login’: denied: requested access to the resource is denied