How to add non_profit app to docker setup

to update apps.txt execute from running container

ls -1 apps > sites/apps.txt

it will recreate apps.txt with all apps available

Edit: this is part of configurator service now. fix: create apps.txt during configuration by revant · Pull Request #1081 · frappe/frappe_docker · GitHub, if anyone adds or removes app from image, just re-run the configurator.

2 Likes

Thanks, this solved my problem!.

YOURE AWESOME!

Thanks for all you do?

@revant_one ow I’m getting a 404 on my assests.

Update it worked by restarting the docker containers!!.

Is the custom container available on docker Hub? I can’t see one with that name.

If not, I assume I have to build it. If I have to do that, why do you pass the apps.json file in through a base 64 encoded environment variable, rather than just ADD it in as a plain file?

Just trying to understand the logic.

  • ADD / COPY needs the full context to be available. That means you need that repo locally and the file to be ADD/COPY need to be in the repo.
  • If we add such file in repo then it will be static, If I need to add few apps to this file, I’ll need to fork the repo and maintain it.
  • if you directly pass stringified json as env var there are high chances of it not getting converted back into json because of shell escape characters, base64 ensures the data remains shell env var friendly

This repository only publishes frappe/erpnext image with no additional app.

source: https://github.com/frappe/frappe_docker/wiki/Frequently-Asked-Questions#how-to-install-official-or-custom-apps

Thanks again @revant_one for your usual rapid and helpful response.

But I don’t understand your answer. The apps.json file only needs to contain:

[
  {
    "url": "https://github.com/frappe/erpnext",
    "branch": "version-14"
  },
  {
    "url": "https://github.com/frappe/payments",
    "branch": "develop"
  },
  {
    "url": "https://github.com/frappe/non_profit.git",
    "branch": "develop"
  }
]

according to frappe_docker/custom-apps.md at main · frappe/frappe_docker · GitHub

Why would that need the repo locally?

Also, I wasn’t suggesting you add apps.json to the repo - like the .env file, I was thinking you could have an example one to copy from. It just seems easier for a new person wanting to fire up a container to copy an example file and edit it, than to create an obscure BASE65 string environment variable from a file.

Not needed. You can skip it. In that case you need to keep track of apps.json somewhere else.

Example repo described it in a post. custom_containers repo has ci directory with working apps.json and other variables. custom_containers/ci at main · castlecraft/custom_containers · GitHub

I am suggesting, for clarity and ease of use, that in images/custom/Containerfile that

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

is replaced by

ADD resources/apps.json /opt/frappe/

and

export APP_INSTALL_ARGS="" && \
  if [ -n "${APPS_JSON_BASE64}" ]; then \
    export APP_INSTALL_ARGS="--apps_path=/opt/frappe/apps.json"; \
  fi && \
  bench init ${APP_INSTALL_ARGS}\

is replaced by

bench init --apps_path=/opt/frappe/apps.json \

Don’t you think that is easier, and clearer?

Fork the repo and do that!

ADD documentation Dockerfile reference | Docker Documentation

Also have a apps.json in your repo. It is just a dockerfile, if you know and use docker you can use it, modify it. In some cases I’m copying the cloned apps in the image and doing bench setup requirements you can do anything you wish.

If you don’t have a repo, have a local directory somewhere and make changes there.

I’m not suggesting this for me (now I have a better idea how it works, I can do that for myself). I’m suggesting it to improve the code, and make it easier to understand and use for the next person.

will it be as simple as making a restapi call and getting an image ready? I wish to use it part of ci only. I don’t do manual builds.

if you are willing, send a PR and after it’s merged answer the questions related to image building. At least for now there are many successful builds without the changes you prefer.

If I’m the only person who is going to answer docker related questions and maintain the repository then you’re stuck with this. I’m not going to change anything.

What’s a restapi call, please? And what has it to do with loading a docker image?

My logic is:
The custom Container is not available on DockerHub (as far as I can see). The only way I know of (in my ignorance) to build it is to:

  • Make a copy of it in a directory, renaming it Dockerfile
  • Make a copy of the resources directory as a subdirectory
  • Add build: <the directory name> to your docker-compose.yml file

If you do that, then why jump through the hoops of creating an apps.json, base64 encoding it, and adding the result to an environment variable. Why not just put the apps.json in the resources folder, and ADD or COPY it into the container?

However, I imagine there is some clever alternative way of building your images, which requires them to be in the directory structure in which you supply them. Don’t know what it is, or how it works, though :frowning:

I’ll not be able to explain you. May be someone else can help.

in brief

  • CI Runner builds the image
  • CI runner push to your private registry
  • Use it anywhere from your registry
  • CI runners have ReST API based triggers to start this build and push process
  • CI runners can take inputs from the rest api request and customise your build
  • For custom cases, use your own files
  • For most cases, kaniko can be used. it can use git repo as context instead of local clone and copy, only dynamic change here is your apps.json which can be passed as env var.

@JRU said “makes sense” here. Can you help? If you’ve tried image building and it makes sense then can you help in clearing the confusion here?

Telegram Bot can build images.

Hi,

I am not deep enough into the topic myself to add much here.
But I found the process of building the custom Image pretty straight forward.
My steps where:

  • git clone https://github.com/frappe/frappe_docker
  • cd frappe_docker
  • export APPS_JSON_BASE64=$(base64 -w 0 ~/my_custom_frappe/apps.json)
  • cp images/custom/Containerfile Dockerfile
  • docker build . --build-arg=FRAPPE_PATH=https://github.com/frappe/frappe --build-arg=FRAPPE_BRANCH=version-14 --build-arg=PYTHON_VERSION=3.10.5 --build-arg=NODE_VERSION=16.18.0 --build-arg=APPS_JSON_BASE64=$APPS_JSON_BASE64 --tag=my_custom_frappe_tag

Done

Maybe a good question to ask would be how would your changes affect this Process?
What would be the new Process what advantages would it bring?

Hope this helps a little bit.

1 Like

Also I wanted to add, I am not using compose here which builds on top of the image.
So for this Additional step I can not speak, but I would say the same questions apply.
What is the current Process and what would change?

Thankyou both for your replies. I now have a volunteer who knows a lot more about Docker, and will no doubt teach me how to use it properly. Things may start to make more sense to me after that!