2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-12-23 10:38:58 +00:00
frappe_docker/custom_app
Revant Nandgaonkar ec584ba9c8
Deprecate assets builder (#922)
* feat: remove assets-builder image

* ci: remove version 12 builds

* fix: v13 nginx builds
2022-09-12 14:20:05 +05:30
..
backend.Dockerfile Remove git reference from install-app (#742) 2022-03-30 12:09:09 +03:00
compose.override.yaml Global refactoring (#617) 2022-03-14 11:23:03 +05:30
docker-bake.hcl Simplify Dockerfiles and custom app guide (#714) 2022-03-23 11:43:47 +03:00
frontend.Dockerfile Deprecate assets builder (#922) 2022-09-12 14:20:05 +05:30
README.md Deprecate assets builder (#922) 2022-09-12 14:20:05 +05:30

This is basic configuration for building images and testing custom apps that use Frappe.

You can see that there's four files in this folder:

  • backend.Dockerfile,
  • frontend.Dockerfile,
  • docker-bake.hcl,
  • compose.override.yaml.

Python code will be built in backend.Dockerfile. JS and CSS (and other fancy frontend stuff) files will be built in frontend.Dockerfile.

docker-bake.hcl is reference file for Buildx Bake. It helps to build images without having to remember all build arguments.

compose.override.yaml is Compose override that replaces images from main compose file so it would use your own images.

To get started, install Docker and Buildx. Then copy all content of this folder (except this README) to your app's root directory. Also copy compose.yaml in the root of this repository.

Before the next step—to build images—replace "custom_app" with your app's name in docker-bake.hcl. After that, let's try to build:

FRAPPE_VERSION=... ERPNEXT_VERSION=... docker buildx bake

💡 We assume that majority of our users use ERPNext, that's why images in this tutorial are based on ERPNext images. If don't want ERPNext, change base image in Dockerfile and remove ERPNEXT_VERSION from bake file. To know more about steps used to build frontend image read comments in frontend.Dockerfile.

If something goes wrong feel free to leave an issue.

To test if site works, setup .env file (check example) and run:

docker-compose -f compose.yaml -f overrides/compose.noproxy.yaml -f overrides/compose.mariadb.yaml -f overrides/compose.redis.yaml -f custom_app/compose.override.yaml up -d
docker-compose exec backend \
  bench new-site 127.0.0.1 \
    --mariadb-root-password 123 \
    --admin-password admin \
    --install-app <Name of your app>
docker-compose restart backend

Cool! You just containerized your app!

Installing multiple apps

Backend builds contain install-app script that places app where it should be. Each call to script installs given app. Usage: install-app [APP_NAME].

If you want to install an app from git, clone it locally, COPY in Dockerfile.