Compare commits
106 Commits
version-12
...
compat-202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6bc8b4041b | ||
|
|
3c77d58e59 | ||
|
|
aab7c0cee6 | ||
|
|
f8e43a3114 | ||
|
|
36f8e63c18 | ||
|
|
5799f87277 | ||
|
|
9859178907 | ||
|
|
cadaa0a0bf | ||
|
|
11fb3fdf60 | ||
|
|
8f7b234a12 | ||
|
|
75e44ba902 | ||
|
|
e9a2512ba2 | ||
|
|
a5667b0774 | ||
|
|
ab59b25e12 | ||
|
|
0f452571af | ||
|
|
fb39fd6415 | ||
|
|
e721081f16 | ||
|
|
b0cc2bffc7 | ||
|
|
d85f54cd7b | ||
|
|
41dd3149ff | ||
|
|
a8adae2c84 | ||
|
|
d15867fea3 | ||
|
|
01fdbfb226 | ||
|
|
70c815b958 | ||
|
|
f48abb6244 | ||
|
|
45c6401da9 | ||
|
|
009877d67c | ||
|
|
19c5e5099c | ||
|
|
c6aa9e21c8 | ||
|
|
d9fa219bb1 | ||
|
|
c35613d64b | ||
|
|
17197aca2c | ||
|
|
51024d819d | ||
|
|
24b96ff6af | ||
|
|
f683edc205 | ||
|
|
915fb780b6 | ||
|
|
41cba18a1a | ||
|
|
77eac51125 | ||
|
|
933fc37209 | ||
|
|
e858078d30 | ||
|
|
b2f6bf1a48 | ||
|
|
7b5eac5d53 | ||
|
|
ac039770dc | ||
|
|
1d707e86be | ||
|
|
bf1f8b4c16 | ||
|
|
63902fd427 | ||
|
|
3661059667 | ||
|
|
e468921b5e | ||
|
|
6c1e8c2c08 | ||
|
|
01bd8f6bb2 | ||
|
|
2a334a2724 | ||
|
|
ba3cadbc4f | ||
|
|
20eab28bab | ||
|
|
bfd847eaca | ||
|
|
d022634811 | ||
|
|
a42e97579f | ||
|
|
8b01439daa | ||
|
|
64257ecaa6 | ||
|
|
83f7db0c50 | ||
|
|
35b944d850 | ||
|
|
37b59843f5 | ||
|
|
ceae7e9ba0 | ||
|
|
82cc15253a | ||
|
|
8e7f8b3b71 | ||
|
|
fcb52d218f | ||
|
|
d0cd1f7afc | ||
|
|
36592fb3fd | ||
|
|
ba68887e40 | ||
|
|
6bfd1f926e | ||
|
|
a7aae8a000 | ||
|
|
8c9322b3a3 | ||
|
|
cfb2f40158 | ||
|
|
41a155283e | ||
|
|
76de3b3ce8 | ||
|
|
1f78fe7204 | ||
|
|
289c2b7bfb | ||
|
|
34a0cfb5b0 | ||
|
|
fdbcd4ff52 | ||
|
|
02fcf42c7c | ||
|
|
cb16ab9091 | ||
|
|
f2c660492e | ||
|
|
a599f8d302 | ||
|
|
821a2be993 | ||
|
|
c90e787b6f | ||
|
|
27ac6e2625 | ||
|
|
980eee9154 | ||
|
|
0446b8ee70 | ||
|
|
4d5c9c4095 | ||
|
|
06cbce1527 | ||
|
|
9bbe95fa99 | ||
|
|
c20078f41f | ||
|
|
8bc5bf6a6d | ||
|
|
301e4770a4 | ||
|
|
537e2d5afb | ||
|
|
2421f2befb | ||
|
|
380b1e06bf | ||
|
|
ec584ba9c8 | ||
|
|
2c1e5425b6 | ||
|
|
81ea33d56e | ||
|
|
61c8de5c08 | ||
|
|
7fac6f3190 | ||
|
|
7ebd7d62b9 | ||
|
|
2cb93e7315 | ||
|
|
8065487c92 | ||
|
|
f60ed87ec8 | ||
|
|
7e5d9c7f53 |
4
.github/workflows/build_bench.yml
vendored
4
.github/workflows/build_bench.yml
vendored
@@ -32,7 +32,7 @@ jobs:
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build and test
|
||||
uses: docker/bake-action@v2.2.0
|
||||
uses: docker/bake-action@v2.3.0
|
||||
with:
|
||||
targets: bench-test
|
||||
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
|
||||
- name: Push
|
||||
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
||||
uses: docker/bake-action@v2.2.0
|
||||
uses: docker/bake-action@v2.3.0
|
||||
with:
|
||||
targets: bench
|
||||
push: true
|
||||
|
||||
12
.github/workflows/build_stable.yml
vendored
12
.github/workflows/build_stable.yml
vendored
@@ -34,16 +34,6 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
v12:
|
||||
uses: ./.github/workflows/docker-build-push.yml
|
||||
with:
|
||||
repo: erpnext
|
||||
version: "12"
|
||||
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
v13:
|
||||
uses: ./.github/workflows/docker-build-push.yml
|
||||
with:
|
||||
@@ -110,7 +100,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Setup deploy key
|
||||
uses: webfactory/ssh-agent@v0.5.4
|
||||
uses: webfactory/ssh-agent@v0.7.0
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.HELM_DEPLOY_KEY }}
|
||||
|
||||
|
||||
4
.github/workflows/docker-build-push.yml
vendored
4
.github/workflows/docker-build-push.yml
vendored
@@ -43,7 +43,7 @@ jobs:
|
||||
run: python3 ./.github/scripts/get_latest_tags.py --repo ${{ inputs.repo }} --version ${{ inputs.version }}
|
||||
|
||||
- name: Build
|
||||
uses: docker/bake-action@v2.2.0
|
||||
uses: docker/bake-action@v2.3.0
|
||||
with:
|
||||
push: true
|
||||
env:
|
||||
@@ -74,6 +74,6 @@ jobs:
|
||||
|
||||
- name: Push
|
||||
if: ${{ inputs.push }}
|
||||
uses: docker/bake-action@v2.2.0
|
||||
uses: docker/bake-action@v2.3.0
|
||||
with:
|
||||
push: true
|
||||
|
||||
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
- uses: actions/stale@v7
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: This issue has been automatically marked as stale. You have a week to explain why you believe this is an error.
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,6 +6,8 @@ sites
|
||||
|
||||
development/*
|
||||
!development/README.md
|
||||
!development/installer.sh
|
||||
!development/apps-example.json
|
||||
!development/vscode-example/
|
||||
|
||||
# Pycharm
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.3.0
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
- id: check-executables-have-shebangs
|
||||
- id: check-shebang-scripts-are-executable
|
||||
@@ -8,28 +8,28 @@ repos:
|
||||
- id: end-of-file-fixer
|
||||
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.37.3
|
||||
rev: v3.3.1
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py37-plus]
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.6.0
|
||||
rev: 22.12.0
|
||||
hooks:
|
||||
- id: black
|
||||
|
||||
- repo: https://github.com/pycqa/isort
|
||||
rev: 5.10.1
|
||||
rev: 5.11.4
|
||||
hooks:
|
||||
- id: isort
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v2.7.1
|
||||
rev: v3.0.0-alpha.4
|
||||
hooks:
|
||||
- id: prettier
|
||||
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.2.1
|
||||
rev: v2.2.2
|
||||
hooks:
|
||||
- id: codespell
|
||||
args:
|
||||
@@ -47,7 +47,7 @@ repos:
|
||||
types: [shell]
|
||||
|
||||
- repo: https://github.com/shellcheck-py/shellcheck-py
|
||||
rev: v0.8.0.4
|
||||
rev: v0.9.0.2
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
args: [-x]
|
||||
|
||||
@@ -35,6 +35,8 @@ services:
|
||||
UPSTREAM_REAL_IP_ADDRESS: ${UPSTREAM_REAL_IP_ADDRESS:-127.0.0.1}
|
||||
UPSTREAM_REAL_IP_HEADER: ${UPSTREAM_REAL_IP_HEADER:-X-Forwarded-For}
|
||||
UPSTREAM_REAL_IP_RECURSIVE: ${UPSTREAM_REAL_IP_RECURSIVE:-off}
|
||||
PROXY_READ_TIMOUT: ${PROXY_READ_TIMOUT:-120}
|
||||
CLIENT_MAX_BODY_SIZE: ${CLIENT_MAX_BODY_SIZE:-50m}
|
||||
volumes:
|
||||
- sites:/usr/share/nginx/html/sites
|
||||
- assets:/usr/share/nginx/html/assets
|
||||
|
||||
@@ -7,9 +7,9 @@ You can see that there's four files in this folder:
|
||||
- `docker-bake.hcl`,
|
||||
- `compose.override.yaml`.
|
||||
|
||||
Python code will `backend.Dockerfile`. JS and CSS (and other fancy frontend stuff) files will be built in `frontend.Dockerfile` if required and served from there.
|
||||
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 cool new [Buildx Bake](https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md). It helps to build images without having to remember all build arguments.
|
||||
`docker-bake.hcl` is reference file for [Buildx Bake](https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md). It helps to build images without having to remember all build arguments.
|
||||
|
||||
`compose.override.yaml` is [Compose](https://docs.docker.com/compose/compose-file/) override that replaces images from [main compose file](https://github.com/frappe/frappe_docker/blob/main/compose.yaml) so it would use your own images.
|
||||
|
||||
@@ -21,7 +21,7 @@ Before the next step—to build images—replace "custom_app" with your app's na
|
||||
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 Dockerfiles and remove ERPNEXT_VERSION from bake file.
|
||||
> 💡 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.
|
||||
|
||||
@@ -41,6 +41,6 @@ Cool! You just containerized your app!
|
||||
|
||||
## Installing multiple apps
|
||||
|
||||
Both backend and frontend builds contain `install-app` script that places app where it should be. Each call to script installs given app. Usage: `install-app [APP_NAME]`.
|
||||
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.
|
||||
|
||||
@@ -1,13 +1,40 @@
|
||||
ARG FRAPPE_VERSION
|
||||
ARG ERPNEXT_VERSION
|
||||
|
||||
FROM frappe/assets-builder:${FRAPPE_VERSION} as assets
|
||||
ARG FRAPPE_VERSION=version-14
|
||||
# Prepare builder image
|
||||
FROM frappe/bench:latest as assets
|
||||
|
||||
ARG FRAPPE_VERSION=version-14
|
||||
ARG ERPNEXT_VERSION=version-14
|
||||
ARG APP_NAME
|
||||
COPY . apps/${APP_NAME}
|
||||
RUN install-app ${APP_NAME}
|
||||
|
||||
# Setup frappe-bench using FRAPPE_VERSION
|
||||
RUN bench init --version=${FRAPPE_VERSION} --skip-redis-config-generation --verbose --skip-assets /home/frappe/frappe-bench
|
||||
WORKDIR /home/frappe/frappe-bench
|
||||
|
||||
# Comment following if ERPNext is not required
|
||||
RUN bench get-app --branch=${ERPNEXT_VERSION} --skip-assets --resolve-deps erpnext
|
||||
|
||||
# Copy custom app(s)
|
||||
COPY --chown=frappe:frappe . apps/${APP_NAME}
|
||||
|
||||
# Setup dependencies
|
||||
RUN bench setup requirements
|
||||
|
||||
# Build static assets, copy files instead of symlink
|
||||
RUN if [ -z "${ERPNEXT_VERSION##*v14*}" ] || [ "$ERPNEXT_VERSION" = "develop" ]; then \
|
||||
export BUILD_OPTS="--production"; \
|
||||
fi \
|
||||
&& FRAPPE_ENV=production bench build --verbose --hard-link ${BUILD_OPTS}
|
||||
|
||||
|
||||
FROM frappe/erpnext-nginx:${ERPNEXT_VERSION}
|
||||
# Use frappe-nginx image with nginx template and env vars
|
||||
FROM frappe/frappe-nginx:${FRAPPE_VERSION}
|
||||
|
||||
COPY --from=assets /out /usr/share/nginx/html
|
||||
# Remove existing assets
|
||||
USER root
|
||||
RUN rm -fr /usr/share/nginx/html/assets
|
||||
|
||||
# Copy built assets
|
||||
COPY --from=assets /home/frappe/frappe-bench/sites/assets /usr/share/nginx/html/assets
|
||||
|
||||
# Use non-root user
|
||||
USER 1000
|
||||
|
||||
@@ -36,6 +36,8 @@ services:
|
||||
- SHELL=/bin/bash
|
||||
volumes:
|
||||
- ..:/workspace:cached
|
||||
# Enable if you require git cloning
|
||||
# - ${HOME}/.ssh:/home/frappe/.ssh
|
||||
working_dir: /workspace/development
|
||||
ports:
|
||||
- 8000-8005:8000-8005
|
||||
|
||||
@@ -11,7 +11,12 @@ In order to start developing you need to satisfy the following prerequisites:
|
||||
It is recommended you allocate at least 4GB of RAM to docker:
|
||||
|
||||
- [Instructions for Windows](https://docs.docker.com/docker-for-windows/#resources)
|
||||
- [Instructions for macOS](https://docs.docker.com/docker-for-mac/#resources)
|
||||
- [Instructions for macOS](https://docs.docker.com/desktop/settings/mac/#advanced)
|
||||
|
||||
Here is a screenshot showing the relevant setting in the Help Manual
|
||||

|
||||
Here is a screenshot showing the settings in Docker Desktop on Mac
|
||||

|
||||
|
||||
## Bootstrap Containers for development
|
||||
|
||||
@@ -61,6 +66,8 @@ Notes:
|
||||
|
||||
### Setup first bench
|
||||
|
||||
> Jump to [scripts](#setup-bench--new-site-using-script) section to setup a bench automatically. Alternatively, you can setup a bench manually using below guide.
|
||||
|
||||
Run the following commands in the terminal inside the container. You might need to create a new terminal in VSCode.
|
||||
|
||||
```shell
|
||||
@@ -68,17 +75,23 @@ bench init --skip-redis-config-generation frappe-bench
|
||||
cd frappe-bench
|
||||
```
|
||||
|
||||
For version 13 use Python 3.9 by passing option to `bench init` command,
|
||||
To setup frappe framework version 14 bench set `PYENV_VERSION` environment variable to `3.10.5` (default) and use NodeJS version 16 (default),
|
||||
|
||||
```shell
|
||||
bench init --skip-redis-config-generation --frappe-branch version-13 --python python3.9 frappe-bench
|
||||
# Use default environments
|
||||
bench init --skip-redis-config-generation --frappe-branch version-14 frappe-bench
|
||||
# Or set environment versions explicitly
|
||||
nvm use v16
|
||||
PYENV_VERSION=3.10.5 bench init --skip-redis-config-generation --frappe-branch version-14 frappe-bench
|
||||
# Switch directory
|
||||
cd frappe-bench
|
||||
```
|
||||
|
||||
For version 12 use Python 3.7 by passing option to `bench init` command,
|
||||
To setup frappe framework version 13 bench set `PYENV_VERSION` environment variable to `3.9.9` and use NodeJS version 14,
|
||||
|
||||
```shell
|
||||
bench init --skip-redis-config-generation --frappe-branch version-12 --python python3.7 frappe-bench
|
||||
nvm use v14
|
||||
PYENV_VERSION=3.9.9 bench init --skip-redis-config-generation --frappe-branch version-13 frappe-bench
|
||||
cd frappe-bench
|
||||
```
|
||||
|
||||
@@ -191,6 +204,13 @@ bench get-app --branch version-12 https://github.com/myusername/myapp
|
||||
bench --site mysite.localhost install-app myapp
|
||||
```
|
||||
|
||||
At the time of this writing, the Payments app has been factored out of the Version 14 ERPNext app and is now a separate app. ERPNext will not install without it, however, so we need to specify `--resolve-deps` command line switch to install it.
|
||||
|
||||
```shell
|
||||
bench get-app --branch version-14 --resolve-deps erpnext
|
||||
bench --site mysite.localhost install-app erpnext
|
||||
```
|
||||
|
||||
To install ERPNext (from the version-13 branch):
|
||||
|
||||
```shell
|
||||
@@ -198,7 +218,7 @@ bench get-app --branch version-13 erpnext
|
||||
bench --site mysite.localhost install-app erpnext
|
||||
```
|
||||
|
||||
Note: Both frappe and erpnext must be on branch with same name. e.g. version-12
|
||||
Note: Both frappe and erpnext must be on branch with same name. e.g. version-14
|
||||
|
||||
### Start Frappe without debugging
|
||||
|
||||
@@ -212,6 +232,39 @@ You can now login with user `Administrator` and the password you choose when cre
|
||||
Your website will now be accessible at location [mysite.localhost:8000](http://mysite.localhost:8000)
|
||||
Note: To start bench with debugger refer section for debugging.
|
||||
|
||||
### Setup bench / new site using script
|
||||
|
||||
Most developers work with numerous clients and versions. Moreover, apps may be required to be installed by everyone on the team working for a client.
|
||||
|
||||
This is simplified using a script to automate the process of creating a new bench / site and installing the required apps.
|
||||
|
||||
Create a copy of apps-example.json and name it apps.json
|
||||
|
||||
```shell
|
||||
cp apps-example.json apps.json
|
||||
```
|
||||
|
||||
Maintain a directory of all client apps in apps.json. Note that Maintaining a fork is optional in apps.json. Also `name` should be app name in apps.json (could be different from repo name).
|
||||
|
||||
> You may have apps in private repos which may require ssh access. You may use SSH from your home directory on linux (configurable in docker-compose.yml).
|
||||
|
||||
After you have created apps.json, run the following command:
|
||||
|
||||
```shell
|
||||
bash installer.sh
|
||||
```
|
||||
|
||||
The script will ask for the following information:
|
||||
|
||||
- Client name (from apps.json).
|
||||
- Bench directory name. If you enter existing bench directory name, it will create a new site in that bench. Else it will create a new bench and site.
|
||||
- Site name (should end with `.localhost`).
|
||||
|
||||
A new bench and / or site is created for the client with following defaults.
|
||||
|
||||
- MariaDB root password: `123`
|
||||
- Admin password: `admin`
|
||||
|
||||
### Start Frappe with Visual Studio Code Python Debugging
|
||||
|
||||
To enable Python debugging inside Visual Studio Code, you must first install the `ms-python.python` extension inside the container. This should have already happened automatically, but depending on your VSCode config, you can force it by:
|
||||
|
||||
15
development/apps-example.json
Normal file
15
development/apps-example.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"client_name": [
|
||||
{
|
||||
"name": "frappe",
|
||||
"branch": "develop",
|
||||
"upstream": "git@github.com:frappe/frappe.git",
|
||||
"fork": "[your fork]"
|
||||
},
|
||||
{
|
||||
"name": "erpnext",
|
||||
"branch": "develop",
|
||||
"upstream": "git@github.com:frappe/erpnext.git"
|
||||
}
|
||||
]
|
||||
}
|
||||
160
development/installer.sh
Executable file
160
development/installer.sh
Executable file
@@ -0,0 +1,160 @@
|
||||
#!/bin/bash
|
||||
# Developer Note: Run this script in the /workspace/development directory
|
||||
|
||||
export NVM_DIR=~/.nvm
|
||||
# shellcheck disable=SC1091
|
||||
source $NVM_DIR/nvm.sh
|
||||
|
||||
sudo apt -qq update && sudo apt -qq install jq -y
|
||||
|
||||
get_client_apps() {
|
||||
apps=$(jq ".\"$client\"" apps.json)
|
||||
|
||||
if [ "$apps" == "null" ]; then
|
||||
echo "No apps found for $client"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
validate_bench_exists() {
|
||||
dir="$(pwd)/$bench_name"
|
||||
if [ -d "$dir" ]; then
|
||||
echo "Bench already exists. Only site will be created"
|
||||
is_existing_bench=true
|
||||
else
|
||||
is_existing_bench=false
|
||||
fi
|
||||
}
|
||||
|
||||
validate_branch() {
|
||||
if [ "$app" == "frappe" ] || [ "$app" == "erpnext" ]; then
|
||||
if [ "$branch" != "develop" ] && [ "$branch" != "version-14" ] && [ "$branch" != "version-13" ]; then
|
||||
echo "Branch should be one of develop or version-14 or version-13"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
validate_site() {
|
||||
if [[ ! "$site_name" =~ ^.*\.localhost$ ]]; then
|
||||
echo "Site name should end with .localhost"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$is_existing_bench" = true ]; then
|
||||
validate_site_exists
|
||||
fi
|
||||
}
|
||||
|
||||
validate_site_exists() {
|
||||
dir="$(pwd)/$bench_name/sites/$site_name"
|
||||
if [ -d "$dir" ]; then
|
||||
echo "Site already exists. Exiting"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
validate_app_exists() {
|
||||
dir="$(pwd)/apps/$app"
|
||||
if [ -d "$dir" ]; then
|
||||
echo "App $app already exists."
|
||||
is_app_installed=true
|
||||
else
|
||||
is_app_installed=false
|
||||
fi
|
||||
}
|
||||
|
||||
add_fork() {
|
||||
dir="$(pwd)/apps/$app"
|
||||
if [ "$fork" != "null" ]; then
|
||||
git -C "$dir" remote add fork "$fork"
|
||||
fi
|
||||
}
|
||||
|
||||
install_apps() {
|
||||
initialize_bench=$1
|
||||
|
||||
for row in $(echo "$apps" | jq -r '.[] | @base64'); do
|
||||
# helper function to retrieve values from dict
|
||||
_jq() {
|
||||
echo "${row}" | base64 --decode | jq -r "${1}"
|
||||
}
|
||||
|
||||
app=$(_jq '.name')
|
||||
branch=$(_jq '.branch')
|
||||
upstream=$(_jq '.upstream')
|
||||
fork=$(_jq '.fork')
|
||||
|
||||
if [ "$initialize_bench" = true ] && [ "$app" == "frappe" ]; then
|
||||
init_bench
|
||||
fi
|
||||
if [ "$initialize_bench" = false ]; then
|
||||
get_apps_from_upstream
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
init_bench() {
|
||||
echo "Creating bench $bench_name"
|
||||
|
||||
if [ "$branch" == "develop" ] || [ "$branch" == "version-14" ]; then
|
||||
python_version=python3.10
|
||||
PYENV_VERSION=3.10.5
|
||||
NODE_VERSION=v16
|
||||
elif [ "$branch" == "version-13" ]; then
|
||||
python_version=python3.9
|
||||
PYENV_VERSION=3.9.9
|
||||
NODE_VERSION=v14
|
||||
fi
|
||||
|
||||
nvm use "$NODE_VERSION"
|
||||
PYENV_VERSION="$PYENV_VERSION" bench init --skip-redis-config-generation --frappe-branch "$branch" --python "$python_version" "$bench_name"
|
||||
cd "$bench_name" || exit
|
||||
|
||||
echo "Setting up config"
|
||||
|
||||
bench set-config -g db_host mariadb
|
||||
bench set-config -g redis_cache redis://redis-cache:6379
|
||||
bench set-config -g redis_queue redis://redis-queue:6379
|
||||
bench set-config -g redis_socketio redis://redis-socketio:6379
|
||||
|
||||
./env/bin/pip install honcho
|
||||
}
|
||||
|
||||
get_apps_from_upstream() {
|
||||
validate_app_exists
|
||||
if [ "$is_app_installed" = false ]; then
|
||||
bench get-app --branch "$branch" --resolve-deps "$app" "$upstream" && add_fork
|
||||
fi
|
||||
|
||||
if [ "$app" != "frappe" ]; then
|
||||
all_apps+=("$app")
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Client Name (from apps.json file)?"
|
||||
read -r client && client=${client:-develop_client} && get_client_apps
|
||||
|
||||
echo "Bench Directory Name? (give name of existing bench to just create a new site) (default: frape-bench)"
|
||||
read -r bench_name && bench_name=${bench_name:-frappe-bench} && validate_bench_exists
|
||||
|
||||
echo "Site Name? (should end with .localhost) (default: site1.localhost)"
|
||||
read -r site_name && site_name=${site_name:-site1.localhost} && validate_site
|
||||
|
||||
if [ "$is_existing_bench" = true ]; then
|
||||
cd "$bench_name" || exit
|
||||
else
|
||||
install_apps true
|
||||
fi
|
||||
|
||||
echo "Getting apps from upstream for $client"
|
||||
all_apps=() && install_apps false
|
||||
|
||||
echo "Creating site $site_name"
|
||||
bench new-site "$site_name" --mariadb-root-password 123 --admin-password admin --no-mariadb-socket
|
||||
|
||||
echo "Installing apps to $site_name"
|
||||
bench --site "$site_name" install-app "${all_apps[@]}"
|
||||
|
||||
bench --site "$site_name" set-config developer_mode 1
|
||||
bench --site "$site_name" clear-cache
|
||||
@@ -45,7 +45,7 @@ target "bench-test" {
|
||||
# Base for all other targets
|
||||
|
||||
group "frappe" {
|
||||
targets = ["frappe-worker", "frappe-nginx", "frappe-socketio", "assets-builder"]
|
||||
targets = ["frappe-worker", "frappe-nginx", "frappe-socketio"]
|
||||
}
|
||||
|
||||
group "erpnext" {
|
||||
@@ -73,8 +73,8 @@ target "default-args" {
|
||||
BENCH_REPO = "${BENCH_REPO}"
|
||||
FRAPPE_VERSION = "${FRAPPE_VERSION}"
|
||||
ERPNEXT_VERSION = "${ERPNEXT_VERSION}"
|
||||
# If `ERPNEXT_VERSION` variable contains "v12" use Python 3.7. If "v13" — 3.9. Else 3.10.
|
||||
PYTHON_VERSION = can(regex("v12", "${ERPNEXT_VERSION}")) ? "3.7" : can(regex("v13", "${ERPNEXT_VERSION}")) ? "3.9" : "3.10"
|
||||
PYTHON_VERSION = can(regex("v13", "${ERPNEXT_VERSION}")) ? "3.9.17" : "3.10.12"
|
||||
NODE_VERSION = can(regex("v13", "${FRAPPE_VERSION}")) ? "14.21.3" : "16.20.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,13 +99,6 @@ target "frappe-nginx" {
|
||||
tags = tag("frappe-nginx", "${FRAPPE_VERSION}")
|
||||
}
|
||||
|
||||
target "assets-builder" {
|
||||
inherits = ["default-args"]
|
||||
context = "images/nginx"
|
||||
target = "assets_builder"
|
||||
tags = tag("assets-builder", "${FRAPPE_VERSION}")
|
||||
}
|
||||
|
||||
target "erpnext-nginx" {
|
||||
inherits = ["default-args"]
|
||||
context = "images/nginx"
|
||||
|
||||
@@ -33,6 +33,7 @@ services:
|
||||
queue-short:
|
||||
networks:
|
||||
- bench-network
|
||||
- mariadb-network
|
||||
queue-long:
|
||||
networks:
|
||||
- bench-network
|
||||
|
||||
BIN
docs/images/Docker Desktop Screenshot - Resources section.png
Normal file
BIN
docs/images/Docker Desktop Screenshot - Resources section.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
BIN
docs/images/Docker Manual Screenshot - Resources section.png
Normal file
BIN
docs/images/Docker Manual Screenshot - Resources section.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
12
example.env
12
example.env
@@ -1,9 +1,9 @@
|
||||
# Reference: https://github.com/frappe/frappe_docker/blob/main/docs/images-and-compose-files.md
|
||||
|
||||
FRAPPE_VERSION=v14.4.3
|
||||
FRAPPE_VERSION=v14.22.0
|
||||
|
||||
# Only with ERPNext override
|
||||
ERPNEXT_VERSION=v14.0.2
|
||||
ERPNEXT_VERSION=v14.12.1
|
||||
|
||||
DB_PASSWORD=123
|
||||
|
||||
@@ -38,3 +38,11 @@ UPSTREAM_REAL_IP_HEADER=
|
||||
# is replaced by the last address sent in the request header field defined by the real_ip_header directive.
|
||||
# If recursive search is enabled, the original client address that matches one of the trusted addresses is replaced by the last non-trusted address sent in the request header field.
|
||||
UPSTREAM_REAL_IP_RECURSIVE=
|
||||
|
||||
# All Values Allowed by nginx proxy_read_timeout are allowed, default value is 120s
|
||||
# Useful if you have longrunning print formats or slow loading sites
|
||||
PROXY_READ_TIMOUT=
|
||||
|
||||
# All Values allowed by nginx client_max_body_size are allowed, default value is 50m
|
||||
# Necessary if the upload limit in the frappe application is increased
|
||||
CLIENT_MAX_BODY_SIZE=
|
||||
|
||||
@@ -13,9 +13,6 @@ RUN apt-get update \
|
||||
postgresql-client \
|
||||
gettext-base \
|
||||
wget \
|
||||
# for ERPNext v12
|
||||
# TODO: Remove after v12 is deprecated
|
||||
python2 \
|
||||
# for PDF
|
||||
libssl-dev \
|
||||
fonts-cantarell \
|
||||
@@ -51,6 +48,22 @@ RUN apt-get update \
|
||||
ssh-client \
|
||||
# VSCode container requirements
|
||||
net-tools \
|
||||
# For pyenv build dependencies
|
||||
# https://github.com/frappe/frappe_docker/issues/840#issuecomment-1185206895
|
||||
make \
|
||||
# For pandas
|
||||
libbz2-dev \
|
||||
# For bench execute
|
||||
libsqlite3-dev \
|
||||
# For other dependencies
|
||||
zlib1g-dev \
|
||||
libreadline-dev \
|
||||
llvm \
|
||||
libncurses5-dev \
|
||||
libncursesw5-dev \
|
||||
xz-utils \
|
||||
tk-dev \
|
||||
liblzma-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
|
||||
@@ -76,9 +89,6 @@ USER frappe
|
||||
WORKDIR /home/frappe
|
||||
|
||||
# Install Python via pyenv
|
||||
# Python 3.7 sits here for ERPNext version-12
|
||||
# TODO: Remove Python 3.7 when version-12 will not be supported
|
||||
ENV PYTHON_VERSION_V12=3.7.12
|
||||
ENV PYTHON_VERSION_V13=3.9.9
|
||||
ENV PYTHON_VERSION=3.10.5
|
||||
ENV PYENV_ROOT /home/frappe/.pyenv
|
||||
@@ -86,10 +96,11 @@ ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
|
||||
|
||||
# From https://github.com/pyenv/pyenv#basic-github-checkout
|
||||
RUN git clone --depth 1 https://github.com/pyenv/pyenv.git .pyenv \
|
||||
&& pyenv install $PYTHON_VERSION_V12 \
|
||||
&& pyenv install $PYTHON_VERSION_V13 \
|
||||
&& pyenv install $PYTHON_VERSION \
|
||||
&& pyenv global $PYTHON_VERSION $PYTHON_VERSION_V12 $PYTHON_VERSION_v13 \
|
||||
&& PYENV_VERSION=$PYTHON_VERSION_V13 pip install --no-cache-dir virtualenv \
|
||||
&& PYENV_VERSION=$PYTHON_VERSION pip install --no-cache-dir virtualenv \
|
||||
&& pyenv global $PYTHON_VERSION $PYTHON_VERSION_v13 \
|
||||
&& sed -Ei -e '/^([^#]|$)/ {a export PYENV_ROOT="/home/frappe/.pyenv" a export PATH="$PYENV_ROOT/bin:$PATH" a ' -e ':a' -e '$!{n;ba};}' ~/.profile \
|
||||
&& echo 'eval "$(pyenv init --path)"' >>~/.profile \
|
||||
&& echo 'eval "$(pyenv init -)"' >>~/.bashrc
|
||||
@@ -100,20 +111,20 @@ ENV PATH /home/frappe/.local/bin:$PATH
|
||||
# Skip editable-bench warning
|
||||
# https://github.com/frappe/bench/commit/20560c97c4246b2480d7358c722bc9ad13606138
|
||||
RUN git clone ${GIT_REPO} --depth 1 -b ${GIT_BRANCH} .bench \
|
||||
&& pip install --user -e .bench \
|
||||
&& pip install --no-cache-dir --user -e .bench \
|
||||
&& echo "export PATH=/home/frappe/.local/bin:\$PATH" >>/home/frappe/.bashrc \
|
||||
&& echo "export BENCH_DEVELOPER=1" >>/home/frappe/.bashrc
|
||||
|
||||
# Install Node via nvm
|
||||
ENV NODE_VERSION=14.18.1
|
||||
ENV NODE_VERSION_FRAPPEV11=10.24.1
|
||||
ENV NODE_VERSION_14=14.19.3
|
||||
ENV NODE_VERSION=16.18.0
|
||||
ENV NVM_DIR /home/frappe/.nvm
|
||||
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
|
||||
|
||||
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \
|
||||
&& . ${NVM_DIR}/nvm.sh \
|
||||
&& nvm install ${NODE_VERSION_FRAPPEV11} \
|
||||
&& nvm use v${NODE_VERSION_FRAPPEV11} \
|
||||
&& nvm install ${NODE_VERSION_14} \
|
||||
&& nvm use v${NODE_VERSION_14} \
|
||||
&& npm install -g yarn \
|
||||
&& nvm install ${NODE_VERSION} \
|
||||
&& nvm use v${NODE_VERSION} \
|
||||
|
||||
@@ -1,46 +1,34 @@
|
||||
FROM node:14-bullseye-slim as assets_builder
|
||||
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
||||
git \
|
||||
build-essential \
|
||||
python \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /frappe-bench
|
||||
|
||||
RUN mkdir -p sites/assets /out/assets \
|
||||
&& echo frappe >sites/apps.txt
|
||||
FROM frappe/bench:latest as assets_builder
|
||||
|
||||
ARG FRAPPE_VERSION
|
||||
ARG FRAPPE_REPO=https://github.com/frappe/frappe
|
||||
# Install development node modules
|
||||
RUN git clone --depth 1 -b ${FRAPPE_VERSION} ${FRAPPE_REPO} apps/frappe \
|
||||
&& yarn --cwd apps/frappe \
|
||||
# TODO: Currently `yarn run production` doesn't create .build on develop branch: https://github.com/frappe/frappe/issues/15396
|
||||
&& if [ ! -f sites/.build ]; then touch sites/.build; fi \
|
||||
&& cp sites/.build /out
|
||||
ARG PYTHON_VERSION
|
||||
ARG NODE_VERSION
|
||||
ENV NVM_DIR=/home/frappe/.nvm
|
||||
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
|
||||
RUN PYENV_VERSION=${PYTHON_VERSION} bench init --version=${FRAPPE_VERSION} --frappe-path=${FRAPPE_REPO} --skip-redis-config-generation --verbose --skip-assets /home/frappe/frappe-bench
|
||||
|
||||
COPY install-app.sh /usr/local/bin/install-app
|
||||
WORKDIR /home/frappe/frappe-bench
|
||||
|
||||
|
||||
FROM assets_builder as frappe_assets
|
||||
|
||||
RUN install-app frappe
|
||||
RUN bench setup requirements \
|
||||
&& if [ -z "${FRAPPE_VERSION##*v14*}" ] || [ "$FRAPPE_VERSION" = "develop" ]; then \
|
||||
export BUILD_OPTS="--production";\
|
||||
fi \
|
||||
&& FRAPPE_ENV=production bench build --verbose --hard-link ${BUILD_OPTS}
|
||||
|
||||
|
||||
FROM assets_builder as erpnext_assets
|
||||
|
||||
ARG PAYMENTS_VERSION=develop
|
||||
ARG PAYMENTS_REPO=https://github.com/frappe/payments
|
||||
ARG ERPNEXT_VERSION
|
||||
ARG ERPNEXT_REPO=https://github.com/frappe/erpnext
|
||||
RUN if [ -z "${ERPNEXT_VERSION##*v14*}" ] || [ "$ERPNEXT_VERSION" = "develop" ]; then \
|
||||
git clone --depth 1 -b ${PAYMENTS_VERSION} ${PAYMENTS_REPO} apps/payments && install-app payments; \
|
||||
RUN bench get-app --branch=${ERPNEXT_VERSION} --skip-assets --resolve-deps erpnext ${ERPNEXT_REPO}\
|
||||
&& if [ -z "${ERPNEXT_VERSION##*v14*}" ] || [ "$ERPNEXT_VERSION" = "develop" ]; then \
|
||||
export BUILD_OPTS="--production"; \
|
||||
fi \
|
||||
&& git clone --depth 1 -b ${ERPNEXT_VERSION} ${ERPNEXT_REPO} apps/erpnext \
|
||||
&& install-app erpnext
|
||||
&& FRAPPE_ENV=production bench build --verbose --hard-link ${BUILD_OPTS}
|
||||
|
||||
|
||||
FROM alpine/git as bench
|
||||
@@ -49,10 +37,14 @@ FROM alpine/git as bench
|
||||
ARG BENCH_REPO=https://github.com/frappe/bench
|
||||
RUN git clone --depth 1 ${BENCH_REPO} /tmp/bench \
|
||||
&& mkdir /out \
|
||||
&& mv /tmp/bench/bench/config/templates/502.html /out/
|
||||
&& mv /tmp/bench/bench/config/templates/502.html /out \
|
||||
&& touch /out/.build
|
||||
|
||||
FROM nginxinc/nginx-unprivileged:1.23.3-alpine as frappe
|
||||
|
||||
FROM nginxinc/nginx-unprivileged:1.23.1-alpine as frappe
|
||||
# Set default ENV variables for backwards compatibility
|
||||
ENV PROXY_READ_TIMOUT=120
|
||||
ENV CLIENT_MAX_BODY_SIZE=50m
|
||||
|
||||
# https://github.com/nginxinc/docker-nginx-unprivileged/blob/main/stable/alpine/20-envsubst-on-templates.sh
|
||||
COPY nginx-template.conf /etc/nginx/templates/default.conf.template
|
||||
@@ -60,11 +52,11 @@ COPY nginx-template.conf /etc/nginx/templates/default.conf.template
|
||||
COPY entrypoint.sh /docker-entrypoint.d/frappe-entrypoint.sh
|
||||
|
||||
COPY --from=bench /out /usr/share/nginx/html/
|
||||
COPY --from=frappe_assets /out /usr/share/nginx/html
|
||||
COPY --from=frappe_assets /home/frappe/frappe-bench/sites/assets /usr/share/nginx/html/assets
|
||||
|
||||
USER 1000
|
||||
|
||||
|
||||
FROM frappe as erpnext
|
||||
|
||||
COPY --from=erpnext_assets /out /usr/share/nginx/html
|
||||
COPY --from=erpnext_assets /home/frappe/frappe-bench/sites/assets /usr/share/nginx/html/assets
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
APP=$1
|
||||
|
||||
cleanup() {
|
||||
rm -rf "apps/$APP"
|
||||
rm -rf sites/assets/*
|
||||
}
|
||||
|
||||
cd /frappe-bench
|
||||
|
||||
if ! test -d "apps/$APP/$APP/public"; then
|
||||
cleanup
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Add all not built assets
|
||||
cp -r "apps/$APP/$APP/public" "/out/assets/$APP"
|
||||
|
||||
# Add production node modules
|
||||
yarn --cwd "apps/$APP" --prod
|
||||
cp -r "apps/$APP/node_modules" "/out/assets/$APP/node_modules"
|
||||
|
||||
# Add built assets
|
||||
yarn --cwd "apps/$APP"
|
||||
echo "$APP" >>sites/apps.txt
|
||||
yarn --cwd apps/frappe run production --app "$APP"
|
||||
cp -r sites/assets /out
|
||||
|
||||
cleanup
|
||||
@@ -37,7 +37,7 @@ server {
|
||||
|
||||
location ~ ^/protected/(.*) {
|
||||
internal;
|
||||
try_files /sites/$http_host/$1 =404;
|
||||
try_files /sites/${FRAPPE_SITE_NAME_HEADER}/$1 =404;
|
||||
}
|
||||
|
||||
location /socket.io {
|
||||
@@ -72,7 +72,7 @@ server {
|
||||
proxy_set_header X-Frappe-Site-Name ${FRAPPE_SITE_NAME_HEADER};
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Use-X-Accel-Redirect True;
|
||||
proxy_read_timeout 120;
|
||||
proxy_read_timeout ${PROXY_READ_TIMOUT};
|
||||
proxy_redirect off;
|
||||
|
||||
proxy_pass http://backend-server;
|
||||
@@ -87,7 +87,7 @@ server {
|
||||
# optimizations
|
||||
sendfile on;
|
||||
keepalive_timeout 15;
|
||||
client_max_body_size 50m;
|
||||
client_max_body_size ${CLIENT_MAX_BODY_SIZE};
|
||||
client_body_buffer_size 16K;
|
||||
client_header_buffer_size 1k;
|
||||
|
||||
|
||||
@@ -2,10 +2,20 @@ FROM alpine/git as builder
|
||||
|
||||
ARG FRAPPE_VERSION
|
||||
ARG FRAPPE_REPO=https://github.com/frappe/frappe
|
||||
RUN apk add -U jq
|
||||
RUN git clone --depth 1 -b ${FRAPPE_VERSION} ${FRAPPE_REPO} /opt/frappe
|
||||
RUN jq --argjson dependencies "$(jq '.dependencies | INDEX( "express", "redis", "socket.io", "superagent" ) as $keep | \
|
||||
del( \
|
||||
. | objects | \
|
||||
.[ \
|
||||
keys_unsorted[] | \
|
||||
select( $keep[ . ] | not ) \
|
||||
] \
|
||||
)' /opt/frappe/package.json)" '.dependencies = $dependencies | del(.scripts.prepare)' /opt/frappe/package.json > /opt/frappe/dependencies.json && \
|
||||
mv /opt/frappe/dependencies.json /opt/frappe/package.json
|
||||
|
||||
|
||||
FROM node:17-alpine
|
||||
# NodeJS LTS
|
||||
FROM node:18-alpine
|
||||
|
||||
RUN addgroup -S frappe \
|
||||
&& adduser -S frappe -G frappe
|
||||
@@ -14,11 +24,10 @@ USER frappe
|
||||
WORKDIR /home/frappe/frappe-bench
|
||||
RUN mkdir -p sites apps/frappe
|
||||
|
||||
COPY --chown=frappe:frappe --from=builder /opt/frappe/socketio.js /opt/frappe/node_utils.js apps/frappe/
|
||||
COPY --chown=frappe:frappe package.json apps/frappe/
|
||||
COPY --chown=frappe:frappe --from=builder /opt/frappe/package.json /opt/frappe/socketio.js /opt/frappe/node_utils.js apps/frappe/
|
||||
|
||||
RUN cd apps/frappe \
|
||||
&& npm install
|
||||
&& npm install --omit=dev
|
||||
|
||||
WORKDIR /home/frappe/frappe-bench/sites
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "frappe-socketio",
|
||||
"version": "1.0.1",
|
||||
"description": "Frappe SocketIO Server",
|
||||
"author": "Revant Nandgaonkar",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"express": "^4.17.1",
|
||||
"redis": "^3.1.1",
|
||||
"socket.io": "^2.4.0",
|
||||
"superagent": "^5.1.0"
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,13 @@ RUN apt-get update \
|
||||
|
||||
RUN useradd -ms /bin/bash frappe
|
||||
USER frappe
|
||||
RUN mkdir -p /home/frappe/frappe-bench/apps /home/frappe/frappe-bench/logs /home/frappe/frappe-bench/sites
|
||||
RUN mkdir -p /home/frappe/frappe-bench/apps /home/frappe/frappe-bench/logs /home/frappe/frappe-bench/sites /home/frappe/frappe-bench/config
|
||||
WORKDIR /home/frappe/frappe-bench
|
||||
|
||||
USER root
|
||||
RUN pip install -U pip wheel \
|
||||
RUN pip install --no-cache-dir -U pip wheel \
|
||||
&& python -m venv env \
|
||||
&& env/bin/pip install -U pip wheel
|
||||
&& env/bin/pip install --no-cache-dir -U pip wheel
|
||||
|
||||
COPY install-app.sh /usr/local/bin/install-app
|
||||
|
||||
@@ -65,15 +65,27 @@ RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
&& git clone --depth 1 -b ${ERPNEXT_VERSION} ${ERPNEXT_REPO} apps/erpnext \
|
||||
&& install-app erpnext
|
||||
|
||||
|
||||
FROM base as configured_base
|
||||
|
||||
ARG WKHTMLTOPDF_VERSION=0.12.6-1
|
||||
|
||||
ARG NODE_VERSION
|
||||
ENV NVM_DIR=/home/frappe/.nvm
|
||||
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
|
||||
RUN apt-get update \
|
||||
# Setup Node lists
|
||||
&& apt-get install --no-install-recommends -y curl \
|
||||
&& curl -sL https://deb.nodesource.com/setup_14.x | bash - \
|
||||
&& apt-get install --no-install-recommends -y curl git \
|
||||
# NodeJS with NVM
|
||||
&& mkdir -p ${NVM_DIR} \
|
||||
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \
|
||||
&& . ${NVM_DIR}/nvm.sh \
|
||||
&& nvm install ${NODE_VERSION} \
|
||||
&& nvm use v${NODE_VERSION} \
|
||||
&& npm install -g yarn \
|
||||
&& nvm alias default v${NODE_VERSION} \
|
||||
&& rm -rf ${NVM_DIR}/.cache \
|
||||
&& echo 'export NVM_DIR="/home/frappe/.nvm"' >>~/.bashrc \
|
||||
&& echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
|
||||
&& echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> ~/.bashrc \
|
||||
# Install wkhtmltopdf with patched qt
|
||||
&& if [ "$(uname -m)" = "aarch64" ]; then export ARCH=arm64; fi \
|
||||
&& if [ "$(uname -m)" = "x86_64" ]; then export ARCH=amd64; fi \
|
||||
@@ -92,8 +104,7 @@ RUN apt-get update \
|
||||
# For healthcheck
|
||||
wait-for-it \
|
||||
jq \
|
||||
# other
|
||||
nodejs \
|
||||
# Clean up
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY pretend-bench.sh /usr/local/bin/bench
|
||||
@@ -127,8 +138,9 @@ USER frappe
|
||||
# Split frappe and erpnext to reduce image size (because of frappe-bench/env/ directory)
|
||||
FROM configured_base as erpnext
|
||||
|
||||
COPY --from=erpnext_builder /home/frappe/frappe-bench/apps /home/frappe/frappe-bench/apps
|
||||
COPY --from=erpnext_builder /home/frappe/frappe-bench/env /home/frappe/frappe-bench/env
|
||||
COPY --from=erpnext_builder /home/frappe/frappe-bench/sites/apps.txt /home/frappe/frappe-bench/sites/
|
||||
COPY --from=erpnext_builder --chown=frappe:frappe /home/frappe/frappe-bench/apps /home/frappe/frappe-bench/apps
|
||||
COPY --from=erpnext_builder --chown=frappe:frappe /home/frappe/frappe-bench/env /home/frappe/frappe-bench/env
|
||||
COPY --from=erpnext_builder --chown=frappe:frappe /home/frappe/frappe-bench/sites/apps.txt /home/frappe/frappe-bench/sites/
|
||||
|
||||
|
||||
USER frappe
|
||||
|
||||
@@ -6,8 +6,6 @@ APP=$1
|
||||
|
||||
cd /home/frappe/frappe-bench
|
||||
|
||||
rm -rf "apps/$APP/.git"
|
||||
|
||||
env/bin/pip install -e "apps/$APP"
|
||||
|
||||
echo "$APP" >>sites/apps.txt
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
x-erpnext-backend-image: &erpnext_backend_image
|
||||
image: frappe/erpnext-worker:${ERPNEXT_VERSION:?No ERPNext version set}
|
||||
volumes:
|
||||
- sites:/home/frappe/frappe-bench/sites
|
||||
- assets:/home/frappe/frappe-bench/sites/assets:ro
|
||||
|
||||
services:
|
||||
configurator:
|
||||
|
||||
25
pwd.yml
25
pwd.yml
@@ -2,7 +2,7 @@ version: "3"
|
||||
|
||||
services:
|
||||
backend:
|
||||
image: frappe/erpnext-worker:v14.0.2
|
||||
image: frappe/erpnext-worker:v14.12.1
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
@@ -11,7 +11,7 @@ services:
|
||||
- assets:/home/frappe/frappe-bench/sites/assets
|
||||
|
||||
configurator:
|
||||
image: frappe/erpnext-worker:v14.0.2
|
||||
image: frappe/erpnext-worker:v14.12.1
|
||||
command:
|
||||
- configure.py
|
||||
environment:
|
||||
@@ -25,7 +25,7 @@ services:
|
||||
- sites:/home/frappe/frappe-bench/sites
|
||||
|
||||
create-site:
|
||||
image: frappe/erpnext-worker:v14.0.2
|
||||
image: frappe/erpnext-worker:v14.12.1
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
@@ -76,7 +76,7 @@ services:
|
||||
- db-data:/var/lib/mysql
|
||||
|
||||
frontend:
|
||||
image: frappe/erpnext-nginx:v14.0.2
|
||||
image: frappe/erpnext-nginx:v14.12.1
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
@@ -87,6 +87,8 @@ services:
|
||||
UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
|
||||
UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
|
||||
UPSTREAM_REAL_IP_RECURSIVE: "off"
|
||||
PROXY_READ_TIMOUT: 120
|
||||
CLIENT_MAX_BODY_SIZE: 50m
|
||||
volumes:
|
||||
- sites:/usr/share/nginx/html/sites
|
||||
- assets:/usr/share/nginx/html/assets
|
||||
@@ -94,7 +96,7 @@ services:
|
||||
- "8080:8080"
|
||||
|
||||
queue-default:
|
||||
image: frappe/erpnext-worker:v14.0.2
|
||||
image: frappe/erpnext-worker:v14.12.1
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
@@ -105,9 +107,10 @@ services:
|
||||
- default
|
||||
volumes:
|
||||
- sites:/home/frappe/frappe-bench/sites
|
||||
- assets:/home/frappe/frappe-bench/sites/assets
|
||||
|
||||
queue-long:
|
||||
image: frappe/erpnext-worker:v14.0.2
|
||||
image: frappe/erpnext-worker:v14.12.1
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
@@ -118,9 +121,10 @@ services:
|
||||
- long
|
||||
volumes:
|
||||
- sites:/home/frappe/frappe-bench/sites
|
||||
- assets:/home/frappe/frappe-bench/sites/assets
|
||||
|
||||
queue-short:
|
||||
image: frappe/erpnext-worker:v14.0.2
|
||||
image: frappe/erpnext-worker:v14.12.1
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
@@ -131,6 +135,7 @@ services:
|
||||
- short
|
||||
volumes:
|
||||
- sites:/home/frappe/frappe-bench/sites
|
||||
- assets:/home/frappe/frappe-bench/sites/assets
|
||||
|
||||
redis-queue:
|
||||
image: redis:6.2-alpine
|
||||
@@ -157,7 +162,7 @@ services:
|
||||
- redis-socketio-data:/data
|
||||
|
||||
scheduler:
|
||||
image: frappe/erpnext-worker:v14.0.2
|
||||
image: frappe/erpnext-worker:v14.12.1
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
@@ -166,14 +171,16 @@ services:
|
||||
- schedule
|
||||
volumes:
|
||||
- sites:/home/frappe/frappe-bench/sites
|
||||
- assets:/home/frappe/frappe-bench/sites/assets
|
||||
|
||||
websocket:
|
||||
image: frappe/frappe-socketio:v14.4.3
|
||||
image: frappe/frappe-socketio:v14.22.0
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
volumes:
|
||||
- sites:/home/frappe/frappe-bench/sites
|
||||
- assets:/home/frappe/frappe-bench/sites/assets
|
||||
|
||||
volumes:
|
||||
assets:
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
frappe @ git+https://github.com/frappe/frappe.git
|
||||
boto3-stubs[s3]
|
||||
black==22.6.0
|
||||
black==22.12.0
|
||||
|
||||
@@ -1 +1 @@
|
||||
pytest==7.1.2
|
||||
pytest==7.2.0
|
||||
|
||||
Reference in New Issue
Block a user