Site Deployment using Frappe Docker

**These are the steps I used to deploy my site using frappe_docker. Are these correct for actual production setup?

Sometimes I would encounter UI Breakage issues, the assets would not get loaded. Why is that happening and How to prevent that from happening?

Frappe Docker Step-wise Integration**

  1. Clone the frappe_docker repository in wsl - https://github.com/frappe/frappe_docker.git

  2. Push the custom app to github.

  3. cd frappe_docker

  4. Create an apps.json file in frappe_docker - nano apps.json

Paste this in the apps.json file -

[

{

"url": "[https://github.com/frappe/erpnext](https://github.com/frappe/erpnext)",

"branch": "version-16"

},

{

"url": "[https://github.com/your-username/your-custom-app.git](https://github.com/your-username/your-custom-app.git)",

"branch": "main"

}

]

  1. Encode this file into a base 64 string format. It will be used as an argument to the Containerfile. Make sure to do it in the same terminal as the build and compose commands. Code for encoding -

export APPS_JSON_BASE64=$(base64 -w 0 apps.json)

Testing if encoding was successful -

echo $APPS_JSON_BASE64

  1. Supported versions - Python 3.14, Node - 24, Frappe version 16.

  2. Run the docker build command in the terminal -

    docker build \

–build-arg=FRAPPE_PATH=https://github.com/frappe/frappe \

–build-arg=FRAPPE_BRANCH=version-16 \

–build-arg=APPS_JSON_BASE64=$APPS_JSON_BASE64 \

–tag=library:15 \

–file=images/custom/Containerfile .

(please refer to frappe_docker documentation(docs/02-Setup/01-Overview) to use the appropriate image Containerfile. For this use case /custom/Containerfile is the most relevant.)

  1. Run the command - cp example.env .env to copy the example.env file into .env and add these lines in the .env file -

    CUSTOM_IMAGE= library(tag written in the docker build command in 7th step)

CUSTOM_TAG=15 (same as above, specifies the version)

PULL_POLICY=never (or if_not_present or missing)(used to use the newly created docker image instead of the default frappe image provided)

  1. Run the docker compose command -

    docker compose --env-file .env -f compose.yaml -f overrides/compose.mariadb.yaml -f overrides/compose.redis.yaml -f overrides/compose.noproxy.yaml config > compose.custom.yaml

  2. Make a small change in the compose.custom.yaml file. In the frontend section, change the volumes path to this - /usr/share/nginx/html/sites

  3. Then run this command -

    docker compose -f compose.custom.yaml up -d

to start the containers.

  1.   Run the command - 
    

    docker compose -p frappe_docker exec -u 0 backend chown -R frappe:frappe /home/frappe/frappe-bench/sites

  2. Now create a new site using this command -

    docker compose -p frappe_docker exec backend bench new-site testsite.localhost(new site name here) --mariadb-user-host-login-scope=‘172.%.%.%’

  3. Install apps onto the site using these commands -

    docker compose -p frappe_docker exec backend bench --site testsite.localhost install-app erpnext

    docker compose -p frappe_docker exec backend bench --site testsite.localhost install-app (your custom app name)

  4. Run the command - sudo nano /etc/hosts and add the ip address and site name in the file.

  5. Open the site on browser using - http://your_site_name:8080

Rebuilding Steps

  1. Encode the apps.json file if there are any new apps added -

    export APPS_JSON_BASE64=$(base64 -w 0 apps.json)

  2. Build the image again. You can change the –tag field if the code version has changed. Has to be the same as the one in the .env file.

docker build --no-cache --build-arg=FRAPPE_PATH=GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript · GitHub --build-arg=FRAPPE_BRANCH=version-16 --build-arg=APPS_JSON_BASE64=$APPS_JSON_BASE64 --tag=library:15 --file=images/custom/Containerfile .

  1. Compose the image. The site will be down during this.

    docker compose -f compose.custom.yaml up -d

  2. Use this command to install the app on your site if new one has been added to the apps.json.

    docker compose -p frappe_docker exec backend bench --site testsite.localhost install-app new_app_name

  3. Migrate the site using this command to add database schema changes.

    docker compose -p frappe_docker exec backend bench --site testsite.localhost migrate

Hi @Ketaki1

If you would prefer a shortcut check out: -

Is the method correct though. And why does the asset issue occur? Can you brief on that please.

I am not sure but maybe you are facing the same problem as this guy: -

Okay. Thank you for your help.