Working on installing Modules to docker

I used docker to install erpnext and frapee
here is the guild I used

I am wondering how I can install a few modules like

Frappe Helpdesk
hr
Frappe Builder

or are you not able to on docker

Hi Eskos,

I just went through this somewhat steep learning curve for installing custom apps. I’m new to both frappe and fairly new to docker. Look at the Frappe_Docker github and read the docs for custom apps.

This will help a lot. The docker files are great, but may take some time to get running.

For production, these docker compose scripts will build an immutable image so working with it is different from what you may be used to with a non-docker dev environment. Also have a look at the DevContainer stuff for development. That has been helpful too.

I’m not using ERPNext, just basic frappe and some other apps so take the following script as advisory. I setup my own custom/Containerfile that removed ERPNext, but otherwise I’m using Frappe Docker with success. The script below builds a new site for me.

#creates the docker site for the LMS system

if [ "$#" -ne 6 ] ; then
  echo "Usage: $0 -a admin_password  -d db_password  -s site_name " >&2
  echo "Site name will be the same as the docker project name."
  exit 1
fi

while getopts s:d:a: flag
do
    case "${flag}" in
        s) site=${OPTARG};;
        d) DB_PASSWORD=${OPTARG};;
        a) admin_passwd=${OPTARG};;
    esac
done

site_env_file=./env/${site}.env

# read docker env file
source $site_env_file

if [ "$COMPOSE_PROJECT_NAME" != "$site" ] ; then
        echo "Compose project name in env file does not match given site: $site"
        echo "Check your env file: ./env/${site}.env"
        exit 2
fi
# save the info, put in safe place when everything is good
site_info_file=.site_info_${site}
date > $site_info_file
echo "Creating '$site': admin password='$admin_passwd' and db_passwd='$DB_PASSWORD'" >> $site_info_file
echo "Do not lose the DB_PASSWORD, external access to db will be lost. It is hashed on service." >> $site_info_file
echo "Admin password maybe changed after setup, don't lose it either." >> $site_info_file
echo "To recreate:" >> $site_info_file
echo "    bin/$0 -a $admin_passwd  -d $DB_PASSWORD -s $site " >> $site_info_file

#needed for ENV in Mariadb container
export DB_PASSWORD

echo "Starting $site with docker compose"
docker compose  --env-file $site_env_file up -d
echo "sleeping 5 seconds while containers start"
sleep 5

echo ""
echo "Adding $site"
docker compose --project-name $site   exec backend bench new-site --no-mariadb-socket \
       --mariadb-root-password $DB_PASSWORD --admin-password $admin_passwd $site

echo "installing apps"
docker compose --project-name $site exec backend bench --site $site install-app lms
docker compose --project-name $site exec backend bench --site $site install-app quiz_master
docker compose --project-name $site exec backend bench --site $site clear-cache

echo ""
echo "Site is now running in docker context: `docker context show` under port=$MY_NGINX_LISTEN"
echo "Login at   http://`hostname`:$MY_NGINX_LISTEN/login"
echo "First login will create a site manager for the system."

Before running this, you need to create the custom image. This is best done (IMHO) using an env file. I created a couple env files for the docker build/compose and require them to have the same as the docker --project-name. Not a requirement, but too many names… I have env files for “prod” and “test”.

Here is an example docker build I am using, the out of the box Containerfile is likely fine for you. I setup a custom one because I don’t need ERPNext. The compose and override files are listed in the referenced env-file.

#!/usr/bin/sh
export APPS_JSON='[
  {
    "url": "https://ghp_your-key-here@github.com/dlaufen/lms.git",
    "branch": "main"
  },
  {
    "url": "https://ghp_your-key-here@github.com/dlaufen/QM.git",
    "branch": "refinements"
  }
]'
export APPS_JSON_BASE64=$(echo ${APPS_JSON} | base64 -w 0)
# call with --env-file prod.env as arg at a minimum
docker build  $* \
  --build-arg=FRAPPE_PATH=https://github.com/frappe/frappe \
  --build-arg=FRAPPE_BRANCH=develop \
  --build-arg=PYTHON_VERSION=3.11.6 \
  --build-arg=NODE_VERSION=18.19.0 \
  --build-arg=APPS_JSON_BASE64=$APPS_JSON_BASE64 \
  --tag=myfrappe:latest \
  --file=images/custom/Containerfile .

The Containerfile above is custom for me, I have the frappe_docker in a sub-dir of my working directory, so anything that is vanilla, will be preceded with ‘frappe_docker/’.

Run the build_image script with something like, including any other env/args you need:
build_image.sh --env-file my_prod.env

The out-of-the-box Env files on frappe_docker will get you started.

I recommend adding the overrides you use with COMPOSE_FILE entry at the top of the env file:

COMPOSE_PROJECT_NAME=test
COMPOSE_FILE="compose.yaml:frappe_docker/overrides/compose.redis.yaml:frappe_docker/overrides/compose.mariadb.yaml:overrides/test.compose.noproxy.yaml"
# custom compose.yaml for a few tools I wanted on the image and a custom noproxy.yaml to change NGINX listen port.

Sorry this got long, but I hope the details help.
Good Luck!

Derek