├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── config.yml ├── stale.yml └── workflows │ └── hooks.yml ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── images ├── 11 │ ├── alpine │ │ ├── .dockerignore │ │ ├── .dockertags │ │ ├── .env │ │ ├── Dockerfile │ │ ├── docker-compose.mariadb.yml │ │ ├── docker-compose.postgres.yml │ │ ├── docker-compose.test.yml │ │ ├── hooks │ │ │ ├── README.md │ │ │ ├── build │ │ │ ├── post_push │ │ │ ├── post_test │ │ │ ├── pre_push │ │ │ ├── pre_test │ │ │ ├── push │ │ │ ├── run │ │ │ └── test │ │ ├── nginx.conf │ │ ├── redis_cache.conf │ │ └── test │ │ │ ├── Dockerfile │ │ │ └── docker_test.sh │ ├── debian-slim │ │ ├── .dockerignore │ │ ├── .dockertags │ │ ├── .env │ │ ├── Dockerfile │ │ ├── docker-compose.mariadb.yml │ │ ├── docker-compose.postgres.yml │ │ ├── docker-compose.test.yml │ │ ├── hooks │ │ │ ├── README.md │ │ │ ├── build │ │ │ ├── post_push │ │ │ ├── post_test │ │ │ ├── pre_push │ │ │ ├── pre_test │ │ │ ├── push │ │ │ ├── run │ │ │ └── test │ │ ├── nginx.conf │ │ ├── redis_cache.conf │ │ └── test │ │ │ ├── Dockerfile │ │ │ └── docker_test.sh │ └── debian │ │ ├── .dockerignore │ │ ├── .dockertags │ │ ├── .env │ │ ├── Dockerfile │ │ ├── docker-compose.mariadb.yml │ │ ├── docker-compose.postgres.yml │ │ ├── docker-compose.test.yml │ │ ├── hooks │ │ ├── README.md │ │ ├── build │ │ ├── post_push │ │ ├── post_test │ │ ├── pre_push │ │ ├── pre_test │ │ ├── push │ │ ├── run │ │ └── test │ │ ├── nginx.conf │ │ ├── redis_cache.conf │ │ └── test │ │ ├── Dockerfile │ │ └── docker_test.sh ├── 12 │ ├── alpine │ │ ├── .dockerignore │ │ ├── .dockertags │ │ ├── .env │ │ ├── Dockerfile │ │ ├── docker-compose.mariadb.yml │ │ ├── docker-compose.postgres.yml │ │ ├── docker-compose.test.yml │ │ ├── hooks │ │ │ ├── README.md │ │ │ ├── build │ │ │ ├── post_push │ │ │ ├── post_test │ │ │ ├── pre_push │ │ │ ├── pre_test │ │ │ ├── push │ │ │ ├── run │ │ │ └── test │ │ ├── nginx.conf │ │ ├── redis_cache.conf │ │ └── test │ │ │ ├── Dockerfile │ │ │ └── docker_test.sh │ ├── debian-slim │ │ ├── .dockerignore │ │ ├── .dockertags │ │ ├── .env │ │ ├── Dockerfile │ │ ├── docker-compose.mariadb.yml │ │ ├── docker-compose.postgres.yml │ │ ├── docker-compose.test.yml │ │ ├── hooks │ │ │ ├── README.md │ │ │ ├── build │ │ │ ├── post_push │ │ │ ├── post_test │ │ │ ├── pre_push │ │ │ ├── pre_test │ │ │ ├── push │ │ │ ├── run │ │ │ └── test │ │ ├── nginx.conf │ │ ├── redis_cache.conf │ │ └── test │ │ │ ├── Dockerfile │ │ │ └── docker_test.sh │ └── debian │ │ ├── .dockerignore │ │ ├── .dockertags │ │ ├── .env │ │ ├── Dockerfile │ │ ├── docker-compose.mariadb.yml │ │ ├── docker-compose.postgres.yml │ │ ├── docker-compose.test.yml │ │ ├── hooks │ │ ├── README.md │ │ ├── build │ │ ├── post_push │ │ ├── post_test │ │ ├── pre_push │ │ ├── pre_test │ │ ├── push │ │ ├── run │ │ └── test │ │ ├── nginx.conf │ │ ├── redis_cache.conf │ │ └── test │ │ ├── Dockerfile │ │ └── docker_test.sh ├── 13 │ ├── alpine │ │ ├── .dockerignore │ │ ├── .dockertags │ │ ├── .env │ │ ├── Dockerfile │ │ ├── docker-compose.mariadb.yml │ │ ├── docker-compose.postgres.yml │ │ ├── docker-compose.test.yml │ │ ├── hooks │ │ │ ├── README.md │ │ │ ├── build │ │ │ ├── post_push │ │ │ ├── post_test │ │ │ ├── pre_push │ │ │ ├── pre_test │ │ │ ├── push │ │ │ ├── run │ │ │ └── test │ │ ├── nginx.conf │ │ ├── redis_cache.conf │ │ └── test │ │ │ ├── Dockerfile │ │ │ └── docker_test.sh │ ├── debian-slim │ │ ├── .dockerignore │ │ ├── .dockertags │ │ ├── .env │ │ ├── Dockerfile │ │ ├── docker-compose.mariadb.yml │ │ ├── docker-compose.postgres.yml │ │ ├── docker-compose.test.yml │ │ ├── hooks │ │ │ ├── README.md │ │ │ ├── build │ │ │ ├── post_push │ │ │ ├── post_test │ │ │ ├── pre_push │ │ │ ├── pre_test │ │ │ ├── push │ │ │ ├── run │ │ │ └── test │ │ ├── nginx.conf │ │ ├── redis_cache.conf │ │ └── test │ │ │ ├── Dockerfile │ │ │ └── docker_test.sh │ └── debian │ │ ├── .dockerignore │ │ ├── .dockertags │ │ ├── .env │ │ ├── Dockerfile │ │ ├── docker-compose.mariadb.yml │ │ ├── docker-compose.postgres.yml │ │ ├── docker-compose.test.yml │ │ ├── hooks │ │ ├── README.md │ │ ├── build │ │ ├── post_push │ │ ├── post_test │ │ ├── pre_push │ │ ├── pre_test │ │ ├── push │ │ ├── run │ │ └── test │ │ ├── nginx.conf │ │ ├── redis_cache.conf │ │ └── test │ │ ├── Dockerfile │ │ └── docker_test.sh └── develop │ ├── alpine │ ├── .dockerignore │ ├── .dockertags │ ├── .env │ ├── Dockerfile │ ├── docker-compose.mariadb.yml │ ├── docker-compose.postgres.yml │ ├── docker-compose.test.yml │ ├── hooks │ │ ├── README.md │ │ ├── build │ │ ├── post_push │ │ ├── post_test │ │ ├── pre_push │ │ ├── pre_test │ │ ├── push │ │ ├── run │ │ └── test │ ├── nginx.conf │ ├── redis_cache.conf │ └── test │ │ ├── Dockerfile │ │ └── docker_test.sh │ ├── debian-slim │ ├── .dockerignore │ ├── .dockertags │ ├── .env │ ├── Dockerfile │ ├── docker-compose.mariadb.yml │ ├── docker-compose.postgres.yml │ ├── docker-compose.test.yml │ ├── hooks │ │ ├── README.md │ │ ├── build │ │ ├── post_push │ │ ├── post_test │ │ ├── pre_push │ │ ├── pre_test │ │ ├── push │ │ ├── run │ │ └── test │ ├── nginx.conf │ ├── redis_cache.conf │ └── test │ │ ├── Dockerfile │ │ └── docker_test.sh │ └── debian │ ├── .dockerignore │ ├── .dockertags │ ├── .env │ ├── Dockerfile │ ├── docker-compose.mariadb.yml │ ├── docker-compose.postgres.yml │ ├── docker-compose.test.yml │ ├── hooks │ ├── README.md │ ├── build │ ├── post_push │ ├── post_test │ ├── pre_push │ ├── pre_test │ ├── push │ ├── run │ └── test │ ├── nginx.conf │ ├── redis_cache.conf │ └── test │ ├── Dockerfile │ └── docker_test.sh ├── template ├── .dockerignore ├── .env ├── Dockerfile.alpine.template ├── Dockerfile.debian.template ├── docker-compose.test.yml ├── docker-compose_mariadb.yml ├── docker-compose_postgres.yml ├── hooks │ ├── README.md │ ├── build │ ├── post_push │ ├── post_test │ ├── pre_push │ ├── pre_test │ ├── push │ ├── run │ └── test ├── nginx.conf ├── redis_cache.conf └── test │ ├── Dockerfile │ └── docker_test.sh └── update.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # Autodetect text files 2 | * text=auto 3 | 4 | # ...Unless the name matches the following 5 | # overriding patterns 6 | 7 | # Definitively text files 8 | *.md text 9 | *.sh text eol=lf 10 | *.yml text eol=lf 11 | Dockerfile text eol=lf 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: madmath03 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | Provide Docker commands or docker-compose file if possible. 21 | 22 | **Expected behavior** 23 | A clear and concise description of what you expected to happen. 24 | 25 | **Screenshots** 26 | If applicable, add screenshots to help explain your problem. 27 | 28 | **Stack trace** 29 | If applicable, add stack trace using `docker logs` or `docker-compose logs` to identify the problem. 30 | 31 | **Docker (please complete the following information):** 32 | 33 | - Docker / Docker-compose Version: (e.g. Docker version 18.03.0-ce, build 0520e24) 34 | - Image (e.g. 7.0-apache) 35 | 36 | **Desktop (please complete the following information):** 37 | 38 | - OS: (e.g. iOS) 39 | - Browser (e.g. chrome, safari) 40 | - Version (e.g. 22) 41 | 42 | **Smartphone (please complete the following information):** 43 | 44 | - Device: (e.g. iPhone6) 45 | - OS: (e.g. iOS8.1) 46 | - Browser (e.g. stock browser, safari) 47 | - Version (e.g. 22) 48 | 49 | **Additional context** 50 | Add any other context about the problem here. 51 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[FEATURE]" 5 | labels: enhancement 6 | assignees: madmath03 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when (...) 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 18 | 19 | > Please provide enough information so that others can review your pull request: 20 | 21 | 22 | 23 | > Explain the **details** for making this change. What existing problem does the pull request solve? 24 | 25 | 26 | 27 | > Screenshots/GIFs 28 | 29 | 30 | -------------------------------------------------------------------------------- /.github/config.yml: -------------------------------------------------------------------------------- 1 | # Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome 2 | 3 | # Comment to be posted to on first time issues 4 | newIssueWelcomeComment: > 5 | Thanks for opening your first issue here! Be sure to follow the issue template! 6 | 7 | # Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome 8 | 9 | # Comment to be posted to on PRs from first time contributors in your repository 10 | newPRWelcomeComment: > 11 | Thanks for opening this pull request! Please check out our contributing guidelines. 12 | 13 | # Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge 14 | 15 | # Comment to be posted to on pull requests merged by a first time user 16 | firstPRMergeComment: > 17 | :tada: Congrats on merging your first pull request! We here at behaviorbot are proud of you! 18 | 19 | # It is recommend to include as many gifs and emojis as possible 20 | 21 | # Configuration for request-info - https://github.com/behaviorbot/request-info 22 | 23 | # *Required* Comment to reply with 24 | requestInfoReplyComment: > 25 | We would appreciate it if you could provide us with more info about this issue/pr! 26 | 27 | # *OPTIONAL* default titles to check against for lack of descriptiveness 28 | # MUST BE ALL LOWERCASE 29 | requestInfoDefaultTitles: 30 | - update readme.md 31 | - updates 32 | 33 | 34 | # *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given 35 | requestInfoLabelToAdd: needs-more-info 36 | 37 | # https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser 38 | blank_issues_enabled: false 39 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | 3 | # Number of days of inactivity before an issue becomes stale 4 | daysUntilStale: 60 5 | # Number of days of inactivity before a stale issue is closed 6 | daysUntilClose: 30 7 | 8 | # Issues with these labels will never be considered stale 9 | exemptLabels: 10 | - pinned 11 | - security 12 | 13 | # Label to use when marking an issue as stale 14 | staleLabel: wontfix 15 | 16 | # Comment to post when marking an issue as stale. Set to `false` to disable 17 | markComment: > 18 | This issue has been automatically marked as stale because it has not had 19 | recent activity. It will be closed if no further activity occurs. Thank you 20 | for your contributions. 21 | 22 | # Comment to post when closing a stale issue. Set to `false` to disable 23 | closeComment: false 24 | -------------------------------------------------------------------------------- /.github/workflows/hooks.yml: -------------------------------------------------------------------------------- 1 | 2 | name: Docker Image CI 3 | 4 | on: 5 | pull_request: 6 | push: 7 | branches: 8 | - main 9 | - master 10 | - develop 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | version: ['develop', '11', '12', '13', ] 19 | variant: ['alpine', 'debian', 'debian-slim'] 20 | 21 | steps: 22 | - name: Check Out Repo 23 | uses: actions/checkout@v2 24 | 25 | - name: Execute CI build hooks 26 | id: docker_build 27 | run: | 28 | cd ./images/${{ matrix.version }}/${{ matrix.variant }}/ 29 | # Export variables to build to GitHub Container Registry 30 | #export DOCKER_REGISTRY=ghcr.io 31 | ./hooks/run build 32 | 33 | - name: Display docker images 34 | run: docker images 35 | 36 | - name: Execute CI test hooks 37 | id: docker_test 38 | run: | 39 | cd ./images/${{ matrix.version }}/${{ matrix.variant }}/ 40 | ./hooks/run test 41 | 42 | - name: Execute CI push hooks 43 | id: docker_push 44 | if: ${{ github.event_name == 'push' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' ) }} 45 | run: | 46 | cd ./images/${{ matrix.version }}/${{ matrix.variant }}/ 47 | # Export variables to login and push to GitHub Container Registry 48 | #export DOCKER_REGISTRY=ghcr.io 49 | #export DOCKER_LOGIN=${{ github.repository_owner }} 50 | #export DOCKER_PASSWORD=${{ secrets.GITHUB_REGISTRY_TOKEN }} 51 | # Export variables to login and push to DockerHub Registry 52 | export DOCKER_LOGIN=${{ secrets.DOCKERHUB_REGISTRY_LOGIN }} 53 | export DOCKER_PASSWORD=${{ secrets.DOCKERHUB_REGISTRY_TOKEN }} 54 | ./hooks/run push 55 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: linux 2 | dist: trusty 3 | 4 | services: docker 5 | 6 | language: shell 7 | 8 | branches: 9 | only: 10 | - master 11 | 12 | before_install: 13 | - env | sort 14 | - export home=$(pwd) 15 | - export image_dir="${home}/images/${VERSION}/${VARIANT}" 16 | - export DOCKER_TAG="${VERSION}-${VARIANT}-travis" 17 | - export IMAGE_NAME="docker-erpnext:${DOCKER_TAG}" 18 | - export IMAGE_ALIAS_NAME="docker-erpnext:${VERSION}" 19 | 20 | install: 21 | - echo "Changing to image directory ($image_dir)" 22 | - cd "$image_dir" 23 | # Test container build 24 | - travis_retry travis_wait 180 docker-compose -f "docker-compose.${DATABASE}.yml" build 25 | 26 | before_script: 27 | - docker images 28 | 29 | script: 30 | - echo "Changing to image directory ($image_dir)" 31 | - cd "$image_dir" 32 | # Test container run 33 | - travis_retry docker-compose -f "docker-compose.${DATABASE}.yml" up -d 34 | - docker-compose -f "docker-compose.${DATABASE}.yml" logs -f "sut" 35 | - docker-compose -f "docker-compose.${DATABASE}.yml" ps 36 | - docker-compose -f "docker-compose.${DATABASE}.yml" logs "erpnext_db" 37 | - docker-compose -f "docker-compose.${DATABASE}.yml" ps "erpnext_db" | grep "Up" 38 | - docker-compose -f "docker-compose.${DATABASE}.yml" logs "erpnext_app" 39 | - docker-compose -f "docker-compose.${DATABASE}.yml" ps "erpnext_app" | grep "Up" 40 | - docker-compose -f "docker-compose.${DATABASE}.yml" logs "erpnext_web" 41 | - docker-compose -f "docker-compose.${DATABASE}.yml" ps "erpnext_web" | grep "Up" 42 | - docker-compose -f "docker-compose.${DATABASE}.yml" ps "sut" | grep "Exit 0" 43 | # Test container restart 44 | - docker-compose -f "docker-compose.${DATABASE}.yml" down 45 | - travis_retry docker-compose -f "docker-compose.${DATABASE}.yml" up -d 46 | - docker-compose -f "docker-compose.${DATABASE}.yml" logs -f "sut" 47 | - docker-compose -f "docker-compose.${DATABASE}.yml" ps 48 | - docker-compose -f "docker-compose.${DATABASE}.yml" logs "erpnext_db" 49 | - docker-compose -f "docker-compose.${DATABASE}.yml" ps "erpnext_db" | grep "Up" || exit 1 50 | - docker-compose -f "docker-compose.${DATABASE}.yml" logs "erpnext_app" 51 | - docker-compose -f "docker-compose.${DATABASE}.yml" ps "erpnext_app" | grep "Up" || exit 1 52 | - docker-compose -f "docker-compose.${DATABASE}.yml" logs "erpnext_web" 53 | - docker-compose -f "docker-compose.${DATABASE}.yml" ps "erpnext_web" | grep "Up" || exit 1 54 | - docker-compose -f "docker-compose.${DATABASE}.yml" ps "sut" | grep "Exit 0" 55 | # Test container migrate 56 | - docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "erpnext_app" bench migrate --help 57 | - docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "erpnext_app" migrate 58 | # Test container backup 59 | - docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "erpnext_app" bench backup --help 60 | - docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "erpnext_app" backup && sleep 5 61 | - docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "erpnext_app" backup && sleep 5 62 | - docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "erpnext_app" backup && sleep 5 63 | # Test container restore 64 | - docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "erpnext_app" bench restore --help 65 | # Test container "old" restore (file number instead of file name) 66 | - docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "erpnext_app" restore 1 67 | 68 | notifications: 69 | email: false 70 | 71 | matrix: 72 | allow_failures: 73 | - env: VERSION=develop VARIANT=alpine DATABASE=postgres 74 | - env: VERSION=develop VARIANT=alpine DATABASE=mariadb 75 | - env: VERSION=develop VARIANT=debian-slim DATABASE=postgres 76 | - env: VERSION=develop VARIANT=debian-slim DATABASE=mariadb 77 | - env: VERSION=develop VARIANT=debian DATABASE=postgres 78 | - env: VERSION=develop VARIANT=debian DATABASE=mariadb 79 | - env: VERSION=13 VARIANT=alpine DATABASE=postgres 80 | - env: VERSION=13 VARIANT=alpine DATABASE=mariadb 81 | - env: VERSION=13 VARIANT=debian-slim DATABASE=postgres 82 | - env: VERSION=13 VARIANT=debian-slim DATABASE=mariadb 83 | - env: VERSION=13 VARIANT=debian DATABASE=postgres 84 | - env: VERSION=13 VARIANT=debian DATABASE=mariadb 85 | # Postgresql does not seem well supported yet... 86 | - env: VERSION=12 VARIANT=alpine DATABASE=postgres 87 | - env: VERSION=12 VARIANT=debian-slim DATABASE=postgres 88 | - env: VERSION=12 VARIANT=debian DATABASE=postgres 89 | # Stop supporting Frappe 10 and Python 2 90 | - env: VERSION=10 VARIANT=alpine DATABASE=mariadb 91 | - env: VERSION=10 VARIANT=debian-slim DATABASE=mariadb 92 | - env: VERSION=10 VARIANT=debian DATABASE=mariadb 93 | 94 | env: # Environments 95 | - VERSION=develop VARIANT=alpine DATABASE=postgres 96 | - VERSION=develop VARIANT=alpine DATABASE=mariadb 97 | - VERSION=develop VARIANT=debian-slim DATABASE=postgres 98 | - VERSION=develop VARIANT=debian-slim DATABASE=mariadb 99 | - VERSION=develop VARIANT=debian DATABASE=postgres 100 | - VERSION=develop VARIANT=debian DATABASE=mariadb 101 | - VERSION=11 VARIANT=alpine DATABASE=postgres 102 | - VERSION=11 VARIANT=alpine DATABASE=mariadb 103 | - VERSION=11 VARIANT=debian-slim DATABASE=postgres 104 | - VERSION=11 VARIANT=debian-slim DATABASE=mariadb 105 | - VERSION=11 VARIANT=debian DATABASE=postgres 106 | - VERSION=11 VARIANT=debian DATABASE=mariadb 107 | - VERSION=12 VARIANT=alpine DATABASE=postgres 108 | - VERSION=12 VARIANT=alpine DATABASE=mariadb 109 | - VERSION=12 VARIANT=debian-slim DATABASE=postgres 110 | - VERSION=12 VARIANT=debian-slim DATABASE=mariadb 111 | - VERSION=12 VARIANT=debian DATABASE=postgres 112 | - VERSION=12 VARIANT=debian DATABASE=mariadb 113 | - VERSION=13 VARIANT=alpine DATABASE=postgres 114 | - VERSION=13 VARIANT=alpine DATABASE=mariadb 115 | - VERSION=13 VARIANT=debian-slim DATABASE=postgres 116 | - VERSION=13 VARIANT=debian-slim DATABASE=mariadb 117 | - VERSION=13 VARIANT=debian DATABASE=postgres 118 | - VERSION=13 VARIANT=debian DATABASE=mariadb 119 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing 2 | ============ 3 | 4 | First of all, **thank you** for contributing, **you are awesome**! 5 | 6 | You can report bugs or request new features by creating an [issue](https://github.com/Monogramm/docker-erpnext/issues), or submit a [pull request](https://github.com/Monogramm/docker-erpnext/pulls) with your contribution. 7 | 8 | Here are a few rules to follow in order to ease code reviews and discussions before maintainers accept and merge your work. 9 | 10 | You MUST follow the [Best practices for writing Dockerfiles](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/). If you don't know about any of them, you should really read the recommendations. 11 | 12 | You MUST run the CI test suite and ensure it is successful. If you haven't enabled it on your fork, it will be automatically triggered when opening/pushing a Pull Request (PR). 13 | 14 | You SHOULD write documentation. 15 | 16 | Please, write [commit messages that make sense](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html), and [rebase your branch](http://git-scm.com/book/en/Git-Branching-Rebasing) before submitting your Pull Request. 17 | 18 | You MUST use the `develop` branch as the base of your Pull Request. 19 | 20 | If possible, use [gitmoji](https://gitmoji.carloscuesta.me/) in your commit message to ease code reviews. 21 | 22 | One may ask you to [squash your commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html) too. This is used to "clean" your Pull Request before merging it (we don't want commits such as `fix tests`, `fix 2`, `fix 3`, etc.). 23 | 24 | Also, while creating your Pull Request on GitHub, you MUST write a description which gives the context and/or explains why you are creating it. If your Pull Request is related to one or several issues, you SHOULD reference them in your PR description. See GitHub documentation on [how to close issues using keywords](https://help.github.com/en/articles/closing-issues-using-keywords). 25 | 26 | Thank you! 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [uri_license]: http://www.gnu.org/licenses/agpl.html 2 | 3 | [uri_license_image]: https://img.shields.io/badge/License-AGPL%20v3-blue.svg 4 | 5 | [![License: AGPL v3][uri_license_image]][uri_license] 6 | [![Build Status](https://travis-ci.org/Monogramm/docker-erpnext.svg)](https://travis-ci.org/Monogramm/docker-erpnext) 7 | [![Docker Automated buid](https://img.shields.io/docker/cloud/build/monogramm/docker-erpnext.svg)](https://hub.docker.com/r/monogramm/docker-erpnext/) 8 | [![Docker Pulls](https://img.shields.io/docker/pulls/monogramm/docker-erpnext.svg)](https://hub.docker.com/r/monogramm/docker-erpnext/) 9 | [![](https://images.microbadger.com/badges/version/monogramm/docker-erpnext.svg)](https://microbadger.com/images/monogramm/docker-erpnext) 10 | [![](https://images.microbadger.com/badges/image/monogramm/docker-erpnext.svg)](https://microbadger.com/images/monogramm/docker-erpnext) 11 | 12 | # ERPNext Docker container 13 | 14 | :whale: Docker image for ERPNext. 15 | 16 | This image was inspired by several other containers developed by the community: 17 | 18 | - [emadshaaban92/docker-compose-erpnext](https://github.com/emadshaaban92/docker-compose-erpnext/) / [BizzoTech/docker-erpnext](https://github.com/BizzoTech/docker-erpnext) for the "_simple_" docker-compose setup 19 | - [donysukardi/docker-frappe](https://github.com/donysukardi/docker-frappe) for the alpine variant (actually the source for BizzoTech images) 20 | - [pipech/erpnext-docker-debian](https://github.com/pipech/erpnext-docker-debian) for the complete setup of apps and sites 21 | 22 | The concept is the following: 23 | 24 | - no need to provide any configuration file: everything will be automatically generated by the container through environnment variables 25 | - the application container sets all the environment variables, the other containers wait for setup to be done 26 | - provide postgresql compatibility 27 | 28 | Check base image [Monogramm/docker-frappe](https://github.com/Monogramm/docker-frappe) for details. 29 | 30 | Check image [Monogramm/docker-erpnext-ext](https://github.com/Monogramm/docker-erpnext-ext) to see how to expand this image and add custom frappe apps. 31 | 32 | ## What is ERPNext ? 33 | 34 | Open Source ERP built for the web. 35 | 36 | > [erpnext.com](https://erpnext.com/) 37 | 38 | > [github erpnext](https://github.com/frappe/erpnext) 39 | 40 | ## Supported tags 41 | 42 | 43 | 44 | 45 | 46 | - 13.5.0-debian 13.5-debian 13-debian debian (`images/13/debian/Dockerfile`) 47 | - 13.5.0-debian-slim 13.5-debian-slim 13-debian-slim debian-slim (`images/13/debian-slim/Dockerfile`) 48 | - 13.5.0-alpine 13.5-alpine 13-alpine alpine 13.5.0 13.5 13 latest (`images/13/alpine/Dockerfile`) 49 | - 12.22.0-debian 12.22-debian 12-debian (`images/12/debian/Dockerfile`) 50 | - 12.22.0-debian-slim 12.22-debian-slim 12-debian-slim (`images/12/debian-slim/Dockerfile`) 51 | - 12.22.0-alpine 12.22-alpine 12-alpine 12.22.0 12.22 12 (`images/12/alpine/Dockerfile`) 52 | - version-11-hotfix-debian 11.x-debian 11-debian (`images/11/debian/Dockerfile`) 53 | - version-11-hotfix-debian-slim 11.x-debian-slim 11-debian-slim (`images/11/debian-slim/Dockerfile`) 54 | - version-11-hotfix-alpine 11.x-alpine 11-alpine version-11-hotfix 11.x 11 (`images/11/alpine/Dockerfile`) 55 | - develop-debian (`images/develop/debian/Dockerfile`) 56 | - develop-debian-slim (`images/develop/debian-slim/Dockerfile`) 57 | - develop-alpine develop (`images/develop/alpine/Dockerfile`) 58 | 59 | 60 | 61 | ## How to run this image ? 62 | 63 | This image does not contain the database for ERPNext. You need to use either an existing database or a database container. 64 | 65 | This image is designed to be used in a micro-service environment using docker-compose. There are basically 2 variants of the image you can choose from: `alpine` or `debian`. 66 | 67 | # Running this image with docker-compose 68 | 69 | - Select the version closest to what you want in the images folder 70 | - In the `docker-compose.yml`, you can comment the `build` lines, uncomment the `image` lines and edit versions to download prebuilt docker container. 71 | - Feel free to edit variables defined in `.env` as you see fit. 72 | - Run the docker-compose with `docker-compose up -d` and that's it. 73 | - Now, go to to access the first run installation wizard. 74 | 75 | # Questions / Issues 76 | 77 | If you got any questions or problems using the image, please visit our [Github Repository](https://github.com/Monogramm/docker-erpnext) and write an issue. 78 | 79 | # References 80 | 81 | A list of a few issues encountered during the development of this container for future reference: 82 | 83 | - ERPNext installs fails with Postgresql due to missing column 84 | - _Solution_: none so far... 85 | - _References_: 86 | - 87 | -------------------------------------------------------------------------------- /images/11/alpine/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files during docker build 2 | 3 | # Docker-compose 4 | docker-compose.yml 5 | .env 6 | 7 | # DockerHub hooks 8 | hooks 9 | .dockertags 10 | 11 | # Custom configuration for tests 12 | redis_cache.conf 13 | nginx.conf 14 | -------------------------------------------------------------------------------- /images/11/alpine/.dockertags: -------------------------------------------------------------------------------- 1 | version-11-hotfix-alpine 11.x-alpine 11-alpine version-11-hotfix 11.x 11 2 | -------------------------------------------------------------------------------- /images/11/alpine/.env: -------------------------------------------------------------------------------- 1 | 2 | ######################################## 3 | # ERPNext configuration 4 | ######################################## 5 | 6 | ERPNEXT_SITE=localhost 7 | ERPNEXT_MAIL_HOST=mail 8 | 9 | ERPNEXT_ADMIN_PWD=erpnext_admin_password 10 | 11 | # Generated with openssl rand -base64 32 12 | ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic= 13 | 14 | ERPNEXT_DB_ROOT_LOGIN=root 15 | ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password 16 | 17 | # DB name will be used as the DB user 18 | ERPNEXT_DB_NAME=erpnext 19 | ERPNEXT_DB_PWD=erpnext_password 20 | 21 | ERPNEXT_SMTP_USER=erpnext 22 | ERPNEXT_SMTP_PWD=docker-erpnext 23 | 24 | -------------------------------------------------------------------------------- /images/11/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:11-alpine 19 | 20 | ARG VERSION=version-11-hotfix 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | sudo apk add python3-dev py3-setuptools; \ 36 | export PATH=/home/$FRAPPE_USER/.local/bin:$PATH; \ 37 | pip3 install Cython==0.29.10; \ 38 | pip3 install numpy==1.17.4; \ 39 | pip3 install pandas==0.24.2; \ 40 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext 41 | 42 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 43 | 44 | ARG TAG 45 | ARG VCS_REF 46 | ARG BUILD_DATE 47 | 48 | # Build environment variables 49 | ENV DOCKER_TAG=${TAG} \ 50 | DOCKER_VCS_REF=${VCS_REF} \ 51 | DOCKER_BUILD_DATE=${BUILD_DATE} 52 | 53 | LABEL maintainer="Monogramm Maintainers " \ 54 | product="ERPNext" \ 55 | version=$VERSION \ 56 | org.label-schema.vcs-ref=$VCS_REF \ 57 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 58 | org.label-schema.build-date=$BUILD_DATE \ 59 | org.label-schema.name="ERPNext" \ 60 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 61 | org.label-schema.url="https://erpnext.com/" \ 62 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 63 | org.label-schema.version=$VERSION \ 64 | org.label-schema.schema-version="1.0" 65 | -------------------------------------------------------------------------------- /images/11/alpine/hooks/README.md: -------------------------------------------------------------------------------- 1 | # DockerHub automated tests hooks 2 | 3 | See documentation for details: 4 | -------------------------------------------------------------------------------- /images/11/alpine/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker build \ 7 | --build-arg "TAG=${DOCKER_TAG}" \ 8 | --build-arg "VCS_REF=$(git rev-parse --short HEAD)" \ 9 | --build-arg "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 10 | -f "$DOCKERFILE_PATH" \ 11 | -t "$IMAGE_NAME" . 12 | -------------------------------------------------------------------------------- /images/11/alpine/hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_REGISTRY}" ]; then 7 | export DOCKER_BASE_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPO} 8 | else 9 | export DOCKER_BASE_IMAGE=${DOCKER_REPO} 10 | fi 11 | 12 | if [ -f ./.dockertags ]; then 13 | for tag in $(cat ./.dockertags); do 14 | if [ ! "${tag}" = "${DOCKER_TAG}" ]; then 15 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$tag" 16 | docker push "$DOCKER_BASE_IMAGE:$tag" 17 | fi 18 | done 19 | fi 20 | 21 | # Push image with tag set to commit hash 22 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 23 | docker push "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 24 | 25 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 26 | if [ -n "${DOCKER_REGISTRY}" ]; then 27 | echo "Logout of Docker Registry ${DOCKER_REGISTRY}..." 28 | docker logout "${DOCKER_REGISTRY}" 29 | else 30 | echo "Logout of Docker default Registry..." 31 | docker logout 32 | fi 33 | fi 34 | -------------------------------------------------------------------------------- /images/11/alpine/hooks/post_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Removing persisted data...' 7 | #rm -rf '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | -------------------------------------------------------------------------------- /images/11/alpine/hooks/pre_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 7 | if [ -n "${DOCKER_REGISTRY}" ]; then 8 | echo "Login to Docker Registry ${DOCKER_REGISTRY}..." 9 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}" 10 | else 11 | echo "Login to Docker default Registry..." 12 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /images/11/alpine/hooks/pre_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Set permissions for persisted data...' 7 | #mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | #chown "1000:1000" '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 9 | #chmod 777 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 10 | -------------------------------------------------------------------------------- /images/11/alpine/hooks/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker push "$IMAGE_NAME" 7 | -------------------------------------------------------------------------------- /images/11/alpine/hooks/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Custom script to run locally DockerHub hooks 4 | # See documentation for details: 5 | # https://docs.docker.com/docker-hub/builds/advanced/ 6 | 7 | echo "Custom script to run locally DockerHub hooks..." 8 | set -e 9 | 10 | export SOURCE_BRANCH 11 | SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) 12 | export SOURCE_COMMIT 13 | SOURCE_COMMIT=$(git rev-parse --short HEAD) 14 | export COMMIT_MSG 15 | COMMIT_MSG=$(git log -1 --format=%s) 16 | 17 | export DOCKER_REPO=monogramm/docker-erpnext 18 | export DOCKERFILE_PATH=Dockerfile 19 | export DOCKER_TAG=11.x 20 | 21 | if [ -n "${DOCKER_REGISTRY}" ]; then 22 | export IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG} 23 | else 24 | export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG} 25 | fi 26 | 27 | # Execute hooks in given order 28 | IFS=',' read -ra STEPS <<< "${1:-build,test}" 29 | for step in "${STEPS[@]}" 30 | do 31 | for hook in "pre_${step}" "${step}" "post_${step}"; do 32 | if [ -f "./hooks/${hook}" ]; then 33 | echo "Executing ${hook} hook..." 34 | "./hooks/${hook}" 35 | fi 36 | done 37 | done 38 | 39 | echo "DockerHub hooks finished" 40 | -------------------------------------------------------------------------------- /images/11/alpine/hooks/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | for file in docker-compose*.test.yml; do 7 | 8 | echo "Starting Test in ${file}..." 9 | 10 | # Build test container 11 | docker-compose --no-ansi -f "${file}" build sut 12 | # Test container run 13 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 14 | docker-compose --no-ansi -f "${file}" logs -f "sut" 15 | docker-compose --no-ansi -f "${file}" ps 16 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 17 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 18 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 19 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 20 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 21 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 22 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 23 | docker-compose --no-ansi -f "${file}" down 24 | # Test container restart 25 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 26 | docker-compose --no-ansi -f "${file}" logs -f "sut" 27 | docker-compose --no-ansi -f "${file}" ps 28 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 29 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 30 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 31 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 32 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 33 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 34 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 35 | docker-compose --no-ansi -f "${file}" down --volumes 36 | 37 | done 38 | -------------------------------------------------------------------------------- /images/11/alpine/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | upstream bench-frappe { 3 | # Call App container from Docker network 4 | server erpnext_app:8000 fail_timeout=0; 5 | } 6 | 7 | upstream bench-socketio-server { 8 | # Call Socketio container from Docker network 9 | server erpnext_socketio:3000 fail_timeout=0; 10 | } 11 | 12 | server { 13 | listen 80; 14 | 15 | server_name localhost; 16 | 17 | root /home/frappe/frappe-bench/sites; 18 | 19 | location /assets { 20 | try_files $uri =404; 21 | } 22 | 23 | location ~ ^/protected/(.*) { 24 | internal; 25 | try_files /$host/$1 =404; 26 | } 27 | 28 | location /socket.io { 29 | proxy_http_version 1.1; 30 | proxy_set_header Upgrade $http_upgrade; 31 | proxy_set_header Connection "upgrade"; 32 | proxy_set_header X-Frappe-Site-Name $host; 33 | proxy_set_header Origin $scheme://$http_host; 34 | proxy_set_header Host $host; 35 | 36 | proxy_pass http://bench-socketio-server; 37 | } 38 | 39 | location / { 40 | try_files /$host/public/$uri @webserver; 41 | } 42 | 43 | location @webserver { 44 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 | proxy_set_header X-Forwarded-Proto $scheme; 46 | proxy_set_header X-Frappe-Site-Name $host; 47 | proxy_set_header Host $host; 48 | proxy_set_header X-Use-X-Accel-Redirect True; 49 | proxy_read_timeout 600; 50 | proxy_redirect off; 51 | 52 | proxy_pass http://bench-frappe; 53 | } 54 | 55 | # error pages 56 | error_page 502 /502.html; 57 | location /502.html { 58 | root /home/frappe/bench-repo/bench/config/templates; 59 | internal; 60 | } 61 | 62 | # optimizations 63 | sendfile on; 64 | keepalive_timeout 15; 65 | client_max_body_size 50m; 66 | client_body_buffer_size 16K; 67 | client_header_buffer_size 1k; 68 | 69 | # enable gzip compresion 70 | # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge 71 | gzip on; 72 | gzip_http_version 1.1; 73 | gzip_comp_level 5; 74 | gzip_min_length 256; 75 | gzip_proxied any; 76 | gzip_vary on; 77 | gzip_types 78 | application/atom+xml 79 | application/javascript 80 | application/json 81 | application/rss+xml 82 | application/vnd.ms-fontobject 83 | application/x-font-ttf 84 | application/font-woff 85 | application/x-web-app-manifest+json 86 | application/xhtml+xml 87 | application/xml 88 | font/opentype 89 | image/svg+xml 90 | image/x-icon 91 | text/css 92 | text/plain 93 | text/x-component 94 | ; 95 | # text/html is always compressed by HttpGzipModule 96 | } 97 | -------------------------------------------------------------------------------- /images/11/alpine/redis_cache.conf: -------------------------------------------------------------------------------- 1 | dbfilename redis_cache.rdb 2 | bind 0.0.0.0 3 | port 6379 4 | maxmemory 292mb 5 | maxmemory-policy allkeys-lru 6 | appendonly no 7 | 8 | save "" -------------------------------------------------------------------------------- /images/11/alpine/test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM monogramm/docker-erpnext:11-alpine 2 | 3 | COPY docker_test.sh /docker_test.sh 4 | 5 | RUN set -ex; \ 6 | sudo chmod 755 /docker_test.sh; 7 | 8 | CMD ["/docker_test.sh"] 9 | -------------------------------------------------------------------------------- /images/11/debian-slim/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files during docker build 2 | 3 | # Docker-compose 4 | docker-compose.yml 5 | .env 6 | 7 | # DockerHub hooks 8 | hooks 9 | .dockertags 10 | 11 | # Custom configuration for tests 12 | redis_cache.conf 13 | nginx.conf 14 | -------------------------------------------------------------------------------- /images/11/debian-slim/.dockertags: -------------------------------------------------------------------------------- 1 | version-11-hotfix-debian-slim 11.x-debian-slim 11-debian-slim 2 | -------------------------------------------------------------------------------- /images/11/debian-slim/.env: -------------------------------------------------------------------------------- 1 | 2 | ######################################## 3 | # ERPNext configuration 4 | ######################################## 5 | 6 | ERPNEXT_SITE=localhost 7 | ERPNEXT_MAIL_HOST=mail 8 | 9 | ERPNEXT_ADMIN_PWD=erpnext_admin_password 10 | 11 | # Generated with openssl rand -base64 32 12 | ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic= 13 | 14 | ERPNEXT_DB_ROOT_LOGIN=root 15 | ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password 16 | 17 | # DB name will be used as the DB user 18 | ERPNEXT_DB_NAME=erpnext 19 | ERPNEXT_DB_PWD=erpnext_password 20 | 21 | ERPNEXT_SMTP_USER=erpnext 22 | ERPNEXT_SMTP_PWD=docker-erpnext 23 | 24 | -------------------------------------------------------------------------------- /images/11/debian-slim/Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:11-debian-slim 19 | 20 | ARG VERSION=version-11-hotfix 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext; \ 36 | sudo ./env/bin/pip3 install \ 37 | ldap3 \ 38 | ; 39 | 40 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 41 | 42 | ARG TAG 43 | ARG VCS_REF 44 | ARG BUILD_DATE 45 | 46 | # Build environment variables 47 | ENV DOCKER_TAG=${TAG} \ 48 | DOCKER_VCS_REF=${VCS_REF} \ 49 | DOCKER_BUILD_DATE=${BUILD_DATE} 50 | 51 | LABEL maintainer="Monogramm Maintainers " \ 52 | product="ERPNext" \ 53 | version=$VERSION \ 54 | org.label-schema.vcs-ref=$VCS_REF \ 55 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 56 | org.label-schema.build-date=$BUILD_DATE \ 57 | org.label-schema.name="ERPNext" \ 58 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 59 | org.label-schema.url="https://erpnext.com/" \ 60 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 61 | org.label-schema.version=$VERSION \ 62 | org.label-schema.schema-version="1.0" 63 | -------------------------------------------------------------------------------- /images/11/debian-slim/hooks/README.md: -------------------------------------------------------------------------------- 1 | # DockerHub automated tests hooks 2 | 3 | See documentation for details: 4 | -------------------------------------------------------------------------------- /images/11/debian-slim/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker build \ 7 | --build-arg "TAG=${DOCKER_TAG}" \ 8 | --build-arg "VCS_REF=$(git rev-parse --short HEAD)" \ 9 | --build-arg "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 10 | -f "$DOCKERFILE_PATH" \ 11 | -t "$IMAGE_NAME" . 12 | -------------------------------------------------------------------------------- /images/11/debian-slim/hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_REGISTRY}" ]; then 7 | export DOCKER_BASE_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPO} 8 | else 9 | export DOCKER_BASE_IMAGE=${DOCKER_REPO} 10 | fi 11 | 12 | if [ -f ./.dockertags ]; then 13 | for tag in $(cat ./.dockertags); do 14 | if [ ! "${tag}" = "${DOCKER_TAG}" ]; then 15 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$tag" 16 | docker push "$DOCKER_BASE_IMAGE:$tag" 17 | fi 18 | done 19 | fi 20 | 21 | # Push image with tag set to commit hash 22 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 23 | docker push "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 24 | 25 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 26 | if [ -n "${DOCKER_REGISTRY}" ]; then 27 | echo "Logout of Docker Registry ${DOCKER_REGISTRY}..." 28 | docker logout "${DOCKER_REGISTRY}" 29 | else 30 | echo "Logout of Docker default Registry..." 31 | docker logout 32 | fi 33 | fi 34 | -------------------------------------------------------------------------------- /images/11/debian-slim/hooks/post_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Removing persisted data...' 7 | #rm -rf '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | -------------------------------------------------------------------------------- /images/11/debian-slim/hooks/pre_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 7 | if [ -n "${DOCKER_REGISTRY}" ]; then 8 | echo "Login to Docker Registry ${DOCKER_REGISTRY}..." 9 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}" 10 | else 11 | echo "Login to Docker default Registry..." 12 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /images/11/debian-slim/hooks/pre_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Set permissions for persisted data...' 7 | #mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | #chown "1000:1000" '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 9 | #chmod 777 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 10 | -------------------------------------------------------------------------------- /images/11/debian-slim/hooks/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker push "$IMAGE_NAME" 7 | -------------------------------------------------------------------------------- /images/11/debian-slim/hooks/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Custom script to run locally DockerHub hooks 4 | # See documentation for details: 5 | # https://docs.docker.com/docker-hub/builds/advanced/ 6 | 7 | echo "Custom script to run locally DockerHub hooks..." 8 | set -e 9 | 10 | export SOURCE_BRANCH 11 | SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) 12 | export SOURCE_COMMIT 13 | SOURCE_COMMIT=$(git rev-parse --short HEAD) 14 | export COMMIT_MSG 15 | COMMIT_MSG=$(git log -1 --format=%s) 16 | 17 | export DOCKER_REPO=monogramm/docker-erpnext 18 | export DOCKERFILE_PATH=Dockerfile 19 | export DOCKER_TAG=11.x 20 | 21 | if [ -n "${DOCKER_REGISTRY}" ]; then 22 | export IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG} 23 | else 24 | export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG} 25 | fi 26 | 27 | # Execute hooks in given order 28 | IFS=',' read -ra STEPS <<< "${1:-build,test}" 29 | for step in "${STEPS[@]}" 30 | do 31 | for hook in "pre_${step}" "${step}" "post_${step}"; do 32 | if [ -f "./hooks/${hook}" ]; then 33 | echo "Executing ${hook} hook..." 34 | "./hooks/${hook}" 35 | fi 36 | done 37 | done 38 | 39 | echo "DockerHub hooks finished" 40 | -------------------------------------------------------------------------------- /images/11/debian-slim/hooks/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | for file in docker-compose*.test.yml; do 7 | 8 | echo "Starting Test in ${file}..." 9 | 10 | # Build test container 11 | docker-compose --no-ansi -f "${file}" build sut 12 | # Test container run 13 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 14 | docker-compose --no-ansi -f "${file}" logs -f "sut" 15 | docker-compose --no-ansi -f "${file}" ps 16 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 17 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 18 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 19 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 20 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 21 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 22 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 23 | docker-compose --no-ansi -f "${file}" down 24 | # Test container restart 25 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 26 | docker-compose --no-ansi -f "${file}" logs -f "sut" 27 | docker-compose --no-ansi -f "${file}" ps 28 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 29 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 30 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 31 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 32 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 33 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 34 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 35 | docker-compose --no-ansi -f "${file}" down --volumes 36 | 37 | done 38 | -------------------------------------------------------------------------------- /images/11/debian-slim/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | upstream bench-frappe { 3 | # Call App container from Docker network 4 | server erpnext_app:8000 fail_timeout=0; 5 | } 6 | 7 | upstream bench-socketio-server { 8 | # Call Socketio container from Docker network 9 | server erpnext_socketio:3000 fail_timeout=0; 10 | } 11 | 12 | server { 13 | listen 80; 14 | 15 | server_name localhost; 16 | 17 | root /home/frappe/frappe-bench/sites; 18 | 19 | location /assets { 20 | try_files $uri =404; 21 | } 22 | 23 | location ~ ^/protected/(.*) { 24 | internal; 25 | try_files /$host/$1 =404; 26 | } 27 | 28 | location /socket.io { 29 | proxy_http_version 1.1; 30 | proxy_set_header Upgrade $http_upgrade; 31 | proxy_set_header Connection "upgrade"; 32 | proxy_set_header X-Frappe-Site-Name $host; 33 | proxy_set_header Origin $scheme://$http_host; 34 | proxy_set_header Host $host; 35 | 36 | proxy_pass http://bench-socketio-server; 37 | } 38 | 39 | location / { 40 | try_files /$host/public/$uri @webserver; 41 | } 42 | 43 | location @webserver { 44 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 | proxy_set_header X-Forwarded-Proto $scheme; 46 | proxy_set_header X-Frappe-Site-Name $host; 47 | proxy_set_header Host $host; 48 | proxy_set_header X-Use-X-Accel-Redirect True; 49 | proxy_read_timeout 600; 50 | proxy_redirect off; 51 | 52 | proxy_pass http://bench-frappe; 53 | } 54 | 55 | # error pages 56 | error_page 502 /502.html; 57 | location /502.html { 58 | root /home/frappe/bench-repo/bench/config/templates; 59 | internal; 60 | } 61 | 62 | # optimizations 63 | sendfile on; 64 | keepalive_timeout 15; 65 | client_max_body_size 50m; 66 | client_body_buffer_size 16K; 67 | client_header_buffer_size 1k; 68 | 69 | # enable gzip compresion 70 | # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge 71 | gzip on; 72 | gzip_http_version 1.1; 73 | gzip_comp_level 5; 74 | gzip_min_length 256; 75 | gzip_proxied any; 76 | gzip_vary on; 77 | gzip_types 78 | application/atom+xml 79 | application/javascript 80 | application/json 81 | application/rss+xml 82 | application/vnd.ms-fontobject 83 | application/x-font-ttf 84 | application/font-woff 85 | application/x-web-app-manifest+json 86 | application/xhtml+xml 87 | application/xml 88 | font/opentype 89 | image/svg+xml 90 | image/x-icon 91 | text/css 92 | text/plain 93 | text/x-component 94 | ; 95 | # text/html is always compressed by HttpGzipModule 96 | } 97 | -------------------------------------------------------------------------------- /images/11/debian-slim/redis_cache.conf: -------------------------------------------------------------------------------- 1 | dbfilename redis_cache.rdb 2 | bind 0.0.0.0 3 | port 6379 4 | maxmemory 292mb 5 | maxmemory-policy allkeys-lru 6 | appendonly no 7 | 8 | save "" -------------------------------------------------------------------------------- /images/11/debian-slim/test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM monogramm/docker-erpnext:11-alpine 2 | 3 | COPY docker_test.sh /docker_test.sh 4 | 5 | RUN set -ex; \ 6 | sudo chmod 755 /docker_test.sh; 7 | 8 | CMD ["/docker_test.sh"] 9 | -------------------------------------------------------------------------------- /images/11/debian/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files during docker build 2 | 3 | # Docker-compose 4 | docker-compose.yml 5 | .env 6 | 7 | # DockerHub hooks 8 | hooks 9 | .dockertags 10 | 11 | # Custom configuration for tests 12 | redis_cache.conf 13 | nginx.conf 14 | -------------------------------------------------------------------------------- /images/11/debian/.dockertags: -------------------------------------------------------------------------------- 1 | version-11-hotfix-debian 11.x-debian 11-debian 2 | -------------------------------------------------------------------------------- /images/11/debian/.env: -------------------------------------------------------------------------------- 1 | 2 | ######################################## 3 | # ERPNext configuration 4 | ######################################## 5 | 6 | ERPNEXT_SITE=localhost 7 | ERPNEXT_MAIL_HOST=mail 8 | 9 | ERPNEXT_ADMIN_PWD=erpnext_admin_password 10 | 11 | # Generated with openssl rand -base64 32 12 | ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic= 13 | 14 | ERPNEXT_DB_ROOT_LOGIN=root 15 | ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password 16 | 17 | # DB name will be used as the DB user 18 | ERPNEXT_DB_NAME=erpnext 19 | ERPNEXT_DB_PWD=erpnext_password 20 | 21 | ERPNEXT_SMTP_USER=erpnext 22 | ERPNEXT_SMTP_PWD=docker-erpnext 23 | 24 | -------------------------------------------------------------------------------- /images/11/debian/Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:11-debian 19 | 20 | ARG VERSION=version-11-hotfix 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext; \ 36 | sudo ./env/bin/pip3 install \ 37 | ldap3 \ 38 | ; 39 | 40 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 41 | 42 | ARG TAG 43 | ARG VCS_REF 44 | ARG BUILD_DATE 45 | 46 | # Build environment variables 47 | ENV DOCKER_TAG=${TAG} \ 48 | DOCKER_VCS_REF=${VCS_REF} \ 49 | DOCKER_BUILD_DATE=${BUILD_DATE} 50 | 51 | LABEL maintainer="Monogramm Maintainers " \ 52 | product="ERPNext" \ 53 | version=$VERSION \ 54 | org.label-schema.vcs-ref=$VCS_REF \ 55 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 56 | org.label-schema.build-date=$BUILD_DATE \ 57 | org.label-schema.name="ERPNext" \ 58 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 59 | org.label-schema.url="https://erpnext.com/" \ 60 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 61 | org.label-schema.version=$VERSION \ 62 | org.label-schema.schema-version="1.0" 63 | -------------------------------------------------------------------------------- /images/11/debian/hooks/README.md: -------------------------------------------------------------------------------- 1 | # DockerHub automated tests hooks 2 | 3 | See documentation for details: 4 | -------------------------------------------------------------------------------- /images/11/debian/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker build \ 7 | --build-arg "TAG=${DOCKER_TAG}" \ 8 | --build-arg "VCS_REF=$(git rev-parse --short HEAD)" \ 9 | --build-arg "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 10 | -f "$DOCKERFILE_PATH" \ 11 | -t "$IMAGE_NAME" . 12 | -------------------------------------------------------------------------------- /images/11/debian/hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_REGISTRY}" ]; then 7 | export DOCKER_BASE_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPO} 8 | else 9 | export DOCKER_BASE_IMAGE=${DOCKER_REPO} 10 | fi 11 | 12 | if [ -f ./.dockertags ]; then 13 | for tag in $(cat ./.dockertags); do 14 | if [ ! "${tag}" = "${DOCKER_TAG}" ]; then 15 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$tag" 16 | docker push "$DOCKER_BASE_IMAGE:$tag" 17 | fi 18 | done 19 | fi 20 | 21 | # Push image with tag set to commit hash 22 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 23 | docker push "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 24 | 25 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 26 | if [ -n "${DOCKER_REGISTRY}" ]; then 27 | echo "Logout of Docker Registry ${DOCKER_REGISTRY}..." 28 | docker logout "${DOCKER_REGISTRY}" 29 | else 30 | echo "Logout of Docker default Registry..." 31 | docker logout 32 | fi 33 | fi 34 | -------------------------------------------------------------------------------- /images/11/debian/hooks/post_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Removing persisted data...' 7 | #rm -rf '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | -------------------------------------------------------------------------------- /images/11/debian/hooks/pre_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 7 | if [ -n "${DOCKER_REGISTRY}" ]; then 8 | echo "Login to Docker Registry ${DOCKER_REGISTRY}..." 9 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}" 10 | else 11 | echo "Login to Docker default Registry..." 12 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /images/11/debian/hooks/pre_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Set permissions for persisted data...' 7 | #mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | #chown "1000:1000" '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 9 | #chmod 777 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 10 | -------------------------------------------------------------------------------- /images/11/debian/hooks/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker push "$IMAGE_NAME" 7 | -------------------------------------------------------------------------------- /images/11/debian/hooks/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Custom script to run locally DockerHub hooks 4 | # See documentation for details: 5 | # https://docs.docker.com/docker-hub/builds/advanced/ 6 | 7 | echo "Custom script to run locally DockerHub hooks..." 8 | set -e 9 | 10 | export SOURCE_BRANCH 11 | SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) 12 | export SOURCE_COMMIT 13 | SOURCE_COMMIT=$(git rev-parse --short HEAD) 14 | export COMMIT_MSG 15 | COMMIT_MSG=$(git log -1 --format=%s) 16 | 17 | export DOCKER_REPO=monogramm/docker-erpnext 18 | export DOCKERFILE_PATH=Dockerfile 19 | export DOCKER_TAG=11.x 20 | 21 | if [ -n "${DOCKER_REGISTRY}" ]; then 22 | export IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG} 23 | else 24 | export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG} 25 | fi 26 | 27 | # Execute hooks in given order 28 | IFS=',' read -ra STEPS <<< "${1:-build,test}" 29 | for step in "${STEPS[@]}" 30 | do 31 | for hook in "pre_${step}" "${step}" "post_${step}"; do 32 | if [ -f "./hooks/${hook}" ]; then 33 | echo "Executing ${hook} hook..." 34 | "./hooks/${hook}" 35 | fi 36 | done 37 | done 38 | 39 | echo "DockerHub hooks finished" 40 | -------------------------------------------------------------------------------- /images/11/debian/hooks/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | for file in docker-compose*.test.yml; do 7 | 8 | echo "Starting Test in ${file}..." 9 | 10 | # Build test container 11 | docker-compose --no-ansi -f "${file}" build sut 12 | # Test container run 13 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 14 | docker-compose --no-ansi -f "${file}" logs -f "sut" 15 | docker-compose --no-ansi -f "${file}" ps 16 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 17 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 18 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 19 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 20 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 21 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 22 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 23 | docker-compose --no-ansi -f "${file}" down 24 | # Test container restart 25 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 26 | docker-compose --no-ansi -f "${file}" logs -f "sut" 27 | docker-compose --no-ansi -f "${file}" ps 28 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 29 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 30 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 31 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 32 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 33 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 34 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 35 | docker-compose --no-ansi -f "${file}" down --volumes 36 | 37 | done 38 | -------------------------------------------------------------------------------- /images/11/debian/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | upstream bench-frappe { 3 | # Call App container from Docker network 4 | server erpnext_app:8000 fail_timeout=0; 5 | } 6 | 7 | upstream bench-socketio-server { 8 | # Call Socketio container from Docker network 9 | server erpnext_socketio:3000 fail_timeout=0; 10 | } 11 | 12 | server { 13 | listen 80; 14 | 15 | server_name localhost; 16 | 17 | root /home/frappe/frappe-bench/sites; 18 | 19 | location /assets { 20 | try_files $uri =404; 21 | } 22 | 23 | location ~ ^/protected/(.*) { 24 | internal; 25 | try_files /$host/$1 =404; 26 | } 27 | 28 | location /socket.io { 29 | proxy_http_version 1.1; 30 | proxy_set_header Upgrade $http_upgrade; 31 | proxy_set_header Connection "upgrade"; 32 | proxy_set_header X-Frappe-Site-Name $host; 33 | proxy_set_header Origin $scheme://$http_host; 34 | proxy_set_header Host $host; 35 | 36 | proxy_pass http://bench-socketio-server; 37 | } 38 | 39 | location / { 40 | try_files /$host/public/$uri @webserver; 41 | } 42 | 43 | location @webserver { 44 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 | proxy_set_header X-Forwarded-Proto $scheme; 46 | proxy_set_header X-Frappe-Site-Name $host; 47 | proxy_set_header Host $host; 48 | proxy_set_header X-Use-X-Accel-Redirect True; 49 | proxy_read_timeout 600; 50 | proxy_redirect off; 51 | 52 | proxy_pass http://bench-frappe; 53 | } 54 | 55 | # error pages 56 | error_page 502 /502.html; 57 | location /502.html { 58 | root /home/frappe/bench-repo/bench/config/templates; 59 | internal; 60 | } 61 | 62 | # optimizations 63 | sendfile on; 64 | keepalive_timeout 15; 65 | client_max_body_size 50m; 66 | client_body_buffer_size 16K; 67 | client_header_buffer_size 1k; 68 | 69 | # enable gzip compresion 70 | # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge 71 | gzip on; 72 | gzip_http_version 1.1; 73 | gzip_comp_level 5; 74 | gzip_min_length 256; 75 | gzip_proxied any; 76 | gzip_vary on; 77 | gzip_types 78 | application/atom+xml 79 | application/javascript 80 | application/json 81 | application/rss+xml 82 | application/vnd.ms-fontobject 83 | application/x-font-ttf 84 | application/font-woff 85 | application/x-web-app-manifest+json 86 | application/xhtml+xml 87 | application/xml 88 | font/opentype 89 | image/svg+xml 90 | image/x-icon 91 | text/css 92 | text/plain 93 | text/x-component 94 | ; 95 | # text/html is always compressed by HttpGzipModule 96 | } 97 | -------------------------------------------------------------------------------- /images/11/debian/redis_cache.conf: -------------------------------------------------------------------------------- 1 | dbfilename redis_cache.rdb 2 | bind 0.0.0.0 3 | port 6379 4 | maxmemory 292mb 5 | maxmemory-policy allkeys-lru 6 | appendonly no 7 | 8 | save "" -------------------------------------------------------------------------------- /images/11/debian/test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM monogramm/docker-erpnext:11-alpine 2 | 3 | COPY docker_test.sh /docker_test.sh 4 | 5 | RUN set -ex; \ 6 | sudo chmod 755 /docker_test.sh; 7 | 8 | CMD ["/docker_test.sh"] 9 | -------------------------------------------------------------------------------- /images/12/alpine/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files during docker build 2 | 3 | # Docker-compose 4 | docker-compose.yml 5 | .env 6 | 7 | # DockerHub hooks 8 | hooks 9 | .dockertags 10 | 11 | # Custom configuration for tests 12 | redis_cache.conf 13 | nginx.conf 14 | -------------------------------------------------------------------------------- /images/12/alpine/.dockertags: -------------------------------------------------------------------------------- 1 | 12.22.0-alpine 12.22-alpine 12-alpine 12.22.0 12.22 12 2 | -------------------------------------------------------------------------------- /images/12/alpine/.env: -------------------------------------------------------------------------------- 1 | 2 | ######################################## 3 | # ERPNext configuration 4 | ######################################## 5 | 6 | ERPNEXT_SITE=localhost 7 | ERPNEXT_MAIL_HOST=mail 8 | 9 | ERPNEXT_ADMIN_PWD=erpnext_admin_password 10 | 11 | # Generated with openssl rand -base64 32 12 | ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic= 13 | 14 | ERPNEXT_DB_ROOT_LOGIN=root 15 | ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password 16 | 17 | # DB name will be used as the DB user 18 | ERPNEXT_DB_NAME=erpnext 19 | ERPNEXT_DB_PWD=erpnext_password 20 | 21 | ERPNEXT_SMTP_USER=erpnext 22 | ERPNEXT_SMTP_PWD=docker-erpnext 23 | 24 | -------------------------------------------------------------------------------- /images/12/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:12-alpine 19 | 20 | ARG VERSION=v12.22.0 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | sudo apk add python3-dev py3-setuptools; \ 36 | export PATH=/home/$FRAPPE_USER/.local/bin:$PATH; \ 37 | pip3 install Cython==0.29.10; \ 38 | pip3 install numpy==1.17.4; \ 39 | pip3 install pandas==0.24.2; \ 40 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext 41 | 42 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 43 | 44 | ARG TAG 45 | ARG VCS_REF 46 | ARG BUILD_DATE 47 | 48 | # Build environment variables 49 | ENV DOCKER_TAG=${TAG} \ 50 | DOCKER_VCS_REF=${VCS_REF} \ 51 | DOCKER_BUILD_DATE=${BUILD_DATE} 52 | 53 | LABEL maintainer="Monogramm Maintainers " \ 54 | product="ERPNext" \ 55 | version=$VERSION \ 56 | org.label-schema.vcs-ref=$VCS_REF \ 57 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 58 | org.label-schema.build-date=$BUILD_DATE \ 59 | org.label-schema.name="ERPNext" \ 60 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 61 | org.label-schema.url="https://erpnext.com/" \ 62 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 63 | org.label-schema.version=$VERSION \ 64 | org.label-schema.schema-version="1.0" 65 | -------------------------------------------------------------------------------- /images/12/alpine/hooks/README.md: -------------------------------------------------------------------------------- 1 | # DockerHub automated tests hooks 2 | 3 | See documentation for details: 4 | -------------------------------------------------------------------------------- /images/12/alpine/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker build \ 7 | --build-arg "TAG=${DOCKER_TAG}" \ 8 | --build-arg "VCS_REF=$(git rev-parse --short HEAD)" \ 9 | --build-arg "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 10 | -f "$DOCKERFILE_PATH" \ 11 | -t "$IMAGE_NAME" . 12 | -------------------------------------------------------------------------------- /images/12/alpine/hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_REGISTRY}" ]; then 7 | export DOCKER_BASE_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPO} 8 | else 9 | export DOCKER_BASE_IMAGE=${DOCKER_REPO} 10 | fi 11 | 12 | if [ -f ./.dockertags ]; then 13 | for tag in $(cat ./.dockertags); do 14 | if [ ! "${tag}" = "${DOCKER_TAG}" ]; then 15 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$tag" 16 | docker push "$DOCKER_BASE_IMAGE:$tag" 17 | fi 18 | done 19 | fi 20 | 21 | # Push image with tag set to commit hash 22 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 23 | docker push "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 24 | 25 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 26 | if [ -n "${DOCKER_REGISTRY}" ]; then 27 | echo "Logout of Docker Registry ${DOCKER_REGISTRY}..." 28 | docker logout "${DOCKER_REGISTRY}" 29 | else 30 | echo "Logout of Docker default Registry..." 31 | docker logout 32 | fi 33 | fi 34 | -------------------------------------------------------------------------------- /images/12/alpine/hooks/post_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Removing persisted data...' 7 | #rm -rf '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | -------------------------------------------------------------------------------- /images/12/alpine/hooks/pre_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 7 | if [ -n "${DOCKER_REGISTRY}" ]; then 8 | echo "Login to Docker Registry ${DOCKER_REGISTRY}..." 9 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}" 10 | else 11 | echo "Login to Docker default Registry..." 12 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /images/12/alpine/hooks/pre_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Set permissions for persisted data...' 7 | #mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | #chown "1000:1000" '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 9 | #chmod 777 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 10 | -------------------------------------------------------------------------------- /images/12/alpine/hooks/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker push "$IMAGE_NAME" 7 | -------------------------------------------------------------------------------- /images/12/alpine/hooks/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Custom script to run locally DockerHub hooks 4 | # See documentation for details: 5 | # https://docs.docker.com/docker-hub/builds/advanced/ 6 | 7 | echo "Custom script to run locally DockerHub hooks..." 8 | set -e 9 | 10 | export SOURCE_BRANCH 11 | SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) 12 | export SOURCE_COMMIT 13 | SOURCE_COMMIT=$(git rev-parse --short HEAD) 14 | export COMMIT_MSG 15 | COMMIT_MSG=$(git log -1 --format=%s) 16 | 17 | export DOCKER_REPO=monogramm/docker-erpnext 18 | export DOCKERFILE_PATH=Dockerfile 19 | export DOCKER_TAG=12.22 20 | 21 | if [ -n "${DOCKER_REGISTRY}" ]; then 22 | export IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG} 23 | else 24 | export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG} 25 | fi 26 | 27 | # Execute hooks in given order 28 | IFS=',' read -ra STEPS <<< "${1:-build,test}" 29 | for step in "${STEPS[@]}" 30 | do 31 | for hook in "pre_${step}" "${step}" "post_${step}"; do 32 | if [ -f "./hooks/${hook}" ]; then 33 | echo "Executing ${hook} hook..." 34 | "./hooks/${hook}" 35 | fi 36 | done 37 | done 38 | 39 | echo "DockerHub hooks finished" 40 | -------------------------------------------------------------------------------- /images/12/alpine/hooks/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | for file in docker-compose*.test.yml; do 7 | 8 | echo "Starting Test in ${file}..." 9 | 10 | # Build test container 11 | docker-compose --no-ansi -f "${file}" build sut 12 | # Test container run 13 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 14 | docker-compose --no-ansi -f "${file}" logs -f "sut" 15 | docker-compose --no-ansi -f "${file}" ps 16 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 17 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 18 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 19 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 20 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 21 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 22 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 23 | docker-compose --no-ansi -f "${file}" down 24 | # Test container restart 25 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 26 | docker-compose --no-ansi -f "${file}" logs -f "sut" 27 | docker-compose --no-ansi -f "${file}" ps 28 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 29 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 30 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 31 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 32 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 33 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 34 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 35 | docker-compose --no-ansi -f "${file}" down --volumes 36 | 37 | done 38 | -------------------------------------------------------------------------------- /images/12/alpine/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | upstream bench-frappe { 3 | # Call App container from Docker network 4 | server erpnext_app:8000 fail_timeout=0; 5 | } 6 | 7 | upstream bench-socketio-server { 8 | # Call Socketio container from Docker network 9 | server erpnext_socketio:3000 fail_timeout=0; 10 | } 11 | 12 | server { 13 | listen 80; 14 | 15 | server_name localhost; 16 | 17 | root /home/frappe/frappe-bench/sites; 18 | 19 | location /assets { 20 | try_files $uri =404; 21 | } 22 | 23 | location ~ ^/protected/(.*) { 24 | internal; 25 | try_files /$host/$1 =404; 26 | } 27 | 28 | location /socket.io { 29 | proxy_http_version 1.1; 30 | proxy_set_header Upgrade $http_upgrade; 31 | proxy_set_header Connection "upgrade"; 32 | proxy_set_header X-Frappe-Site-Name $host; 33 | proxy_set_header Origin $scheme://$http_host; 34 | proxy_set_header Host $host; 35 | 36 | proxy_pass http://bench-socketio-server; 37 | } 38 | 39 | location / { 40 | try_files /$host/public/$uri @webserver; 41 | } 42 | 43 | location @webserver { 44 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 | proxy_set_header X-Forwarded-Proto $scheme; 46 | proxy_set_header X-Frappe-Site-Name $host; 47 | proxy_set_header Host $host; 48 | proxy_set_header X-Use-X-Accel-Redirect True; 49 | proxy_read_timeout 600; 50 | proxy_redirect off; 51 | 52 | proxy_pass http://bench-frappe; 53 | } 54 | 55 | # error pages 56 | error_page 502 /502.html; 57 | location /502.html { 58 | root /home/frappe/bench-repo/bench/config/templates; 59 | internal; 60 | } 61 | 62 | # optimizations 63 | sendfile on; 64 | keepalive_timeout 15; 65 | client_max_body_size 50m; 66 | client_body_buffer_size 16K; 67 | client_header_buffer_size 1k; 68 | 69 | # enable gzip compresion 70 | # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge 71 | gzip on; 72 | gzip_http_version 1.1; 73 | gzip_comp_level 5; 74 | gzip_min_length 256; 75 | gzip_proxied any; 76 | gzip_vary on; 77 | gzip_types 78 | application/atom+xml 79 | application/javascript 80 | application/json 81 | application/rss+xml 82 | application/vnd.ms-fontobject 83 | application/x-font-ttf 84 | application/font-woff 85 | application/x-web-app-manifest+json 86 | application/xhtml+xml 87 | application/xml 88 | font/opentype 89 | image/svg+xml 90 | image/x-icon 91 | text/css 92 | text/plain 93 | text/x-component 94 | ; 95 | # text/html is always compressed by HttpGzipModule 96 | } 97 | -------------------------------------------------------------------------------- /images/12/alpine/redis_cache.conf: -------------------------------------------------------------------------------- 1 | dbfilename redis_cache.rdb 2 | bind 0.0.0.0 3 | port 6379 4 | maxmemory 292mb 5 | maxmemory-policy allkeys-lru 6 | appendonly no 7 | 8 | save "" -------------------------------------------------------------------------------- /images/12/alpine/test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM monogramm/docker-erpnext:12-alpine 2 | 3 | COPY docker_test.sh /docker_test.sh 4 | 5 | RUN set -ex; \ 6 | sudo chmod 755 /docker_test.sh; 7 | 8 | CMD ["/docker_test.sh"] 9 | -------------------------------------------------------------------------------- /images/12/debian-slim/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files during docker build 2 | 3 | # Docker-compose 4 | docker-compose.yml 5 | .env 6 | 7 | # DockerHub hooks 8 | hooks 9 | .dockertags 10 | 11 | # Custom configuration for tests 12 | redis_cache.conf 13 | nginx.conf 14 | -------------------------------------------------------------------------------- /images/12/debian-slim/.dockertags: -------------------------------------------------------------------------------- 1 | 12.22.0-debian-slim 12.22-debian-slim 12-debian-slim 2 | -------------------------------------------------------------------------------- /images/12/debian-slim/.env: -------------------------------------------------------------------------------- 1 | 2 | ######################################## 3 | # ERPNext configuration 4 | ######################################## 5 | 6 | ERPNEXT_SITE=localhost 7 | ERPNEXT_MAIL_HOST=mail 8 | 9 | ERPNEXT_ADMIN_PWD=erpnext_admin_password 10 | 11 | # Generated with openssl rand -base64 32 12 | ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic= 13 | 14 | ERPNEXT_DB_ROOT_LOGIN=root 15 | ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password 16 | 17 | # DB name will be used as the DB user 18 | ERPNEXT_DB_NAME=erpnext 19 | ERPNEXT_DB_PWD=erpnext_password 20 | 21 | ERPNEXT_SMTP_USER=erpnext 22 | ERPNEXT_SMTP_PWD=docker-erpnext 23 | 24 | -------------------------------------------------------------------------------- /images/12/debian-slim/Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:12-debian-slim 19 | 20 | ARG VERSION=v12.22.0 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext; \ 36 | sudo ./env/bin/pip3 install \ 37 | ldap3 \ 38 | ; 39 | 40 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 41 | 42 | ARG TAG 43 | ARG VCS_REF 44 | ARG BUILD_DATE 45 | 46 | # Build environment variables 47 | ENV DOCKER_TAG=${TAG} \ 48 | DOCKER_VCS_REF=${VCS_REF} \ 49 | DOCKER_BUILD_DATE=${BUILD_DATE} 50 | 51 | LABEL maintainer="Monogramm Maintainers " \ 52 | product="ERPNext" \ 53 | version=$VERSION \ 54 | org.label-schema.vcs-ref=$VCS_REF \ 55 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 56 | org.label-schema.build-date=$BUILD_DATE \ 57 | org.label-schema.name="ERPNext" \ 58 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 59 | org.label-schema.url="https://erpnext.com/" \ 60 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 61 | org.label-schema.version=$VERSION \ 62 | org.label-schema.schema-version="1.0" 63 | -------------------------------------------------------------------------------- /images/12/debian-slim/hooks/README.md: -------------------------------------------------------------------------------- 1 | # DockerHub automated tests hooks 2 | 3 | See documentation for details: 4 | -------------------------------------------------------------------------------- /images/12/debian-slim/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker build \ 7 | --build-arg "TAG=${DOCKER_TAG}" \ 8 | --build-arg "VCS_REF=$(git rev-parse --short HEAD)" \ 9 | --build-arg "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 10 | -f "$DOCKERFILE_PATH" \ 11 | -t "$IMAGE_NAME" . 12 | -------------------------------------------------------------------------------- /images/12/debian-slim/hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_REGISTRY}" ]; then 7 | export DOCKER_BASE_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPO} 8 | else 9 | export DOCKER_BASE_IMAGE=${DOCKER_REPO} 10 | fi 11 | 12 | if [ -f ./.dockertags ]; then 13 | for tag in $(cat ./.dockertags); do 14 | if [ ! "${tag}" = "${DOCKER_TAG}" ]; then 15 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$tag" 16 | docker push "$DOCKER_BASE_IMAGE:$tag" 17 | fi 18 | done 19 | fi 20 | 21 | # Push image with tag set to commit hash 22 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 23 | docker push "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 24 | 25 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 26 | if [ -n "${DOCKER_REGISTRY}" ]; then 27 | echo "Logout of Docker Registry ${DOCKER_REGISTRY}..." 28 | docker logout "${DOCKER_REGISTRY}" 29 | else 30 | echo "Logout of Docker default Registry..." 31 | docker logout 32 | fi 33 | fi 34 | -------------------------------------------------------------------------------- /images/12/debian-slim/hooks/post_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Removing persisted data...' 7 | #rm -rf '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | -------------------------------------------------------------------------------- /images/12/debian-slim/hooks/pre_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 7 | if [ -n "${DOCKER_REGISTRY}" ]; then 8 | echo "Login to Docker Registry ${DOCKER_REGISTRY}..." 9 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}" 10 | else 11 | echo "Login to Docker default Registry..." 12 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /images/12/debian-slim/hooks/pre_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Set permissions for persisted data...' 7 | #mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | #chown "1000:1000" '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 9 | #chmod 777 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 10 | -------------------------------------------------------------------------------- /images/12/debian-slim/hooks/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker push "$IMAGE_NAME" 7 | -------------------------------------------------------------------------------- /images/12/debian-slim/hooks/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Custom script to run locally DockerHub hooks 4 | # See documentation for details: 5 | # https://docs.docker.com/docker-hub/builds/advanced/ 6 | 7 | echo "Custom script to run locally DockerHub hooks..." 8 | set -e 9 | 10 | export SOURCE_BRANCH 11 | SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) 12 | export SOURCE_COMMIT 13 | SOURCE_COMMIT=$(git rev-parse --short HEAD) 14 | export COMMIT_MSG 15 | COMMIT_MSG=$(git log -1 --format=%s) 16 | 17 | export DOCKER_REPO=monogramm/docker-erpnext 18 | export DOCKERFILE_PATH=Dockerfile 19 | export DOCKER_TAG=12.22 20 | 21 | if [ -n "${DOCKER_REGISTRY}" ]; then 22 | export IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG} 23 | else 24 | export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG} 25 | fi 26 | 27 | # Execute hooks in given order 28 | IFS=',' read -ra STEPS <<< "${1:-build,test}" 29 | for step in "${STEPS[@]}" 30 | do 31 | for hook in "pre_${step}" "${step}" "post_${step}"; do 32 | if [ -f "./hooks/${hook}" ]; then 33 | echo "Executing ${hook} hook..." 34 | "./hooks/${hook}" 35 | fi 36 | done 37 | done 38 | 39 | echo "DockerHub hooks finished" 40 | -------------------------------------------------------------------------------- /images/12/debian-slim/hooks/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | for file in docker-compose*.test.yml; do 7 | 8 | echo "Starting Test in ${file}..." 9 | 10 | # Build test container 11 | docker-compose --no-ansi -f "${file}" build sut 12 | # Test container run 13 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 14 | docker-compose --no-ansi -f "${file}" logs -f "sut" 15 | docker-compose --no-ansi -f "${file}" ps 16 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 17 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 18 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 19 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 20 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 21 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 22 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 23 | docker-compose --no-ansi -f "${file}" down 24 | # Test container restart 25 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 26 | docker-compose --no-ansi -f "${file}" logs -f "sut" 27 | docker-compose --no-ansi -f "${file}" ps 28 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 29 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 30 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 31 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 32 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 33 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 34 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 35 | docker-compose --no-ansi -f "${file}" down --volumes 36 | 37 | done 38 | -------------------------------------------------------------------------------- /images/12/debian-slim/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | upstream bench-frappe { 3 | # Call App container from Docker network 4 | server erpnext_app:8000 fail_timeout=0; 5 | } 6 | 7 | upstream bench-socketio-server { 8 | # Call Socketio container from Docker network 9 | server erpnext_socketio:3000 fail_timeout=0; 10 | } 11 | 12 | server { 13 | listen 80; 14 | 15 | server_name localhost; 16 | 17 | root /home/frappe/frappe-bench/sites; 18 | 19 | location /assets { 20 | try_files $uri =404; 21 | } 22 | 23 | location ~ ^/protected/(.*) { 24 | internal; 25 | try_files /$host/$1 =404; 26 | } 27 | 28 | location /socket.io { 29 | proxy_http_version 1.1; 30 | proxy_set_header Upgrade $http_upgrade; 31 | proxy_set_header Connection "upgrade"; 32 | proxy_set_header X-Frappe-Site-Name $host; 33 | proxy_set_header Origin $scheme://$http_host; 34 | proxy_set_header Host $host; 35 | 36 | proxy_pass http://bench-socketio-server; 37 | } 38 | 39 | location / { 40 | try_files /$host/public/$uri @webserver; 41 | } 42 | 43 | location @webserver { 44 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 | proxy_set_header X-Forwarded-Proto $scheme; 46 | proxy_set_header X-Frappe-Site-Name $host; 47 | proxy_set_header Host $host; 48 | proxy_set_header X-Use-X-Accel-Redirect True; 49 | proxy_read_timeout 600; 50 | proxy_redirect off; 51 | 52 | proxy_pass http://bench-frappe; 53 | } 54 | 55 | # error pages 56 | error_page 502 /502.html; 57 | location /502.html { 58 | root /home/frappe/bench-repo/bench/config/templates; 59 | internal; 60 | } 61 | 62 | # optimizations 63 | sendfile on; 64 | keepalive_timeout 15; 65 | client_max_body_size 50m; 66 | client_body_buffer_size 16K; 67 | client_header_buffer_size 1k; 68 | 69 | # enable gzip compresion 70 | # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge 71 | gzip on; 72 | gzip_http_version 1.1; 73 | gzip_comp_level 5; 74 | gzip_min_length 256; 75 | gzip_proxied any; 76 | gzip_vary on; 77 | gzip_types 78 | application/atom+xml 79 | application/javascript 80 | application/json 81 | application/rss+xml 82 | application/vnd.ms-fontobject 83 | application/x-font-ttf 84 | application/font-woff 85 | application/x-web-app-manifest+json 86 | application/xhtml+xml 87 | application/xml 88 | font/opentype 89 | image/svg+xml 90 | image/x-icon 91 | text/css 92 | text/plain 93 | text/x-component 94 | ; 95 | # text/html is always compressed by HttpGzipModule 96 | } 97 | -------------------------------------------------------------------------------- /images/12/debian-slim/redis_cache.conf: -------------------------------------------------------------------------------- 1 | dbfilename redis_cache.rdb 2 | bind 0.0.0.0 3 | port 6379 4 | maxmemory 292mb 5 | maxmemory-policy allkeys-lru 6 | appendonly no 7 | 8 | save "" -------------------------------------------------------------------------------- /images/12/debian-slim/test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM monogramm/docker-erpnext:12-alpine 2 | 3 | COPY docker_test.sh /docker_test.sh 4 | 5 | RUN set -ex; \ 6 | sudo chmod 755 /docker_test.sh; 7 | 8 | CMD ["/docker_test.sh"] 9 | -------------------------------------------------------------------------------- /images/12/debian/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files during docker build 2 | 3 | # Docker-compose 4 | docker-compose.yml 5 | .env 6 | 7 | # DockerHub hooks 8 | hooks 9 | .dockertags 10 | 11 | # Custom configuration for tests 12 | redis_cache.conf 13 | nginx.conf 14 | -------------------------------------------------------------------------------- /images/12/debian/.dockertags: -------------------------------------------------------------------------------- 1 | 12.22.0-debian 12.22-debian 12-debian 2 | -------------------------------------------------------------------------------- /images/12/debian/.env: -------------------------------------------------------------------------------- 1 | 2 | ######################################## 3 | # ERPNext configuration 4 | ######################################## 5 | 6 | ERPNEXT_SITE=localhost 7 | ERPNEXT_MAIL_HOST=mail 8 | 9 | ERPNEXT_ADMIN_PWD=erpnext_admin_password 10 | 11 | # Generated with openssl rand -base64 32 12 | ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic= 13 | 14 | ERPNEXT_DB_ROOT_LOGIN=root 15 | ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password 16 | 17 | # DB name will be used as the DB user 18 | ERPNEXT_DB_NAME=erpnext 19 | ERPNEXT_DB_PWD=erpnext_password 20 | 21 | ERPNEXT_SMTP_USER=erpnext 22 | ERPNEXT_SMTP_PWD=docker-erpnext 23 | 24 | -------------------------------------------------------------------------------- /images/12/debian/Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:12-debian 19 | 20 | ARG VERSION=v12.22.0 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext; \ 36 | sudo ./env/bin/pip3 install \ 37 | ldap3 \ 38 | ; 39 | 40 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 41 | 42 | ARG TAG 43 | ARG VCS_REF 44 | ARG BUILD_DATE 45 | 46 | # Build environment variables 47 | ENV DOCKER_TAG=${TAG} \ 48 | DOCKER_VCS_REF=${VCS_REF} \ 49 | DOCKER_BUILD_DATE=${BUILD_DATE} 50 | 51 | LABEL maintainer="Monogramm Maintainers " \ 52 | product="ERPNext" \ 53 | version=$VERSION \ 54 | org.label-schema.vcs-ref=$VCS_REF \ 55 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 56 | org.label-schema.build-date=$BUILD_DATE \ 57 | org.label-schema.name="ERPNext" \ 58 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 59 | org.label-schema.url="https://erpnext.com/" \ 60 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 61 | org.label-schema.version=$VERSION \ 62 | org.label-schema.schema-version="1.0" 63 | -------------------------------------------------------------------------------- /images/12/debian/hooks/README.md: -------------------------------------------------------------------------------- 1 | # DockerHub automated tests hooks 2 | 3 | See documentation for details: 4 | -------------------------------------------------------------------------------- /images/12/debian/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker build \ 7 | --build-arg "TAG=${DOCKER_TAG}" \ 8 | --build-arg "VCS_REF=$(git rev-parse --short HEAD)" \ 9 | --build-arg "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 10 | -f "$DOCKERFILE_PATH" \ 11 | -t "$IMAGE_NAME" . 12 | -------------------------------------------------------------------------------- /images/12/debian/hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_REGISTRY}" ]; then 7 | export DOCKER_BASE_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPO} 8 | else 9 | export DOCKER_BASE_IMAGE=${DOCKER_REPO} 10 | fi 11 | 12 | if [ -f ./.dockertags ]; then 13 | for tag in $(cat ./.dockertags); do 14 | if [ ! "${tag}" = "${DOCKER_TAG}" ]; then 15 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$tag" 16 | docker push "$DOCKER_BASE_IMAGE:$tag" 17 | fi 18 | done 19 | fi 20 | 21 | # Push image with tag set to commit hash 22 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 23 | docker push "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 24 | 25 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 26 | if [ -n "${DOCKER_REGISTRY}" ]; then 27 | echo "Logout of Docker Registry ${DOCKER_REGISTRY}..." 28 | docker logout "${DOCKER_REGISTRY}" 29 | else 30 | echo "Logout of Docker default Registry..." 31 | docker logout 32 | fi 33 | fi 34 | -------------------------------------------------------------------------------- /images/12/debian/hooks/post_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Removing persisted data...' 7 | #rm -rf '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | -------------------------------------------------------------------------------- /images/12/debian/hooks/pre_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 7 | if [ -n "${DOCKER_REGISTRY}" ]; then 8 | echo "Login to Docker Registry ${DOCKER_REGISTRY}..." 9 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}" 10 | else 11 | echo "Login to Docker default Registry..." 12 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /images/12/debian/hooks/pre_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Set permissions for persisted data...' 7 | #mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | #chown "1000:1000" '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 9 | #chmod 777 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 10 | -------------------------------------------------------------------------------- /images/12/debian/hooks/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker push "$IMAGE_NAME" 7 | -------------------------------------------------------------------------------- /images/12/debian/hooks/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Custom script to run locally DockerHub hooks 4 | # See documentation for details: 5 | # https://docs.docker.com/docker-hub/builds/advanced/ 6 | 7 | echo "Custom script to run locally DockerHub hooks..." 8 | set -e 9 | 10 | export SOURCE_BRANCH 11 | SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) 12 | export SOURCE_COMMIT 13 | SOURCE_COMMIT=$(git rev-parse --short HEAD) 14 | export COMMIT_MSG 15 | COMMIT_MSG=$(git log -1 --format=%s) 16 | 17 | export DOCKER_REPO=monogramm/docker-erpnext 18 | export DOCKERFILE_PATH=Dockerfile 19 | export DOCKER_TAG=12.22 20 | 21 | if [ -n "${DOCKER_REGISTRY}" ]; then 22 | export IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG} 23 | else 24 | export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG} 25 | fi 26 | 27 | # Execute hooks in given order 28 | IFS=',' read -ra STEPS <<< "${1:-build,test}" 29 | for step in "${STEPS[@]}" 30 | do 31 | for hook in "pre_${step}" "${step}" "post_${step}"; do 32 | if [ -f "./hooks/${hook}" ]; then 33 | echo "Executing ${hook} hook..." 34 | "./hooks/${hook}" 35 | fi 36 | done 37 | done 38 | 39 | echo "DockerHub hooks finished" 40 | -------------------------------------------------------------------------------- /images/12/debian/hooks/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | for file in docker-compose*.test.yml; do 7 | 8 | echo "Starting Test in ${file}..." 9 | 10 | # Build test container 11 | docker-compose --no-ansi -f "${file}" build sut 12 | # Test container run 13 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 14 | docker-compose --no-ansi -f "${file}" logs -f "sut" 15 | docker-compose --no-ansi -f "${file}" ps 16 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 17 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 18 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 19 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 20 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 21 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 22 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 23 | docker-compose --no-ansi -f "${file}" down 24 | # Test container restart 25 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 26 | docker-compose --no-ansi -f "${file}" logs -f "sut" 27 | docker-compose --no-ansi -f "${file}" ps 28 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 29 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 30 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 31 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 32 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 33 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 34 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 35 | docker-compose --no-ansi -f "${file}" down --volumes 36 | 37 | done 38 | -------------------------------------------------------------------------------- /images/12/debian/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | upstream bench-frappe { 3 | # Call App container from Docker network 4 | server erpnext_app:8000 fail_timeout=0; 5 | } 6 | 7 | upstream bench-socketio-server { 8 | # Call Socketio container from Docker network 9 | server erpnext_socketio:3000 fail_timeout=0; 10 | } 11 | 12 | server { 13 | listen 80; 14 | 15 | server_name localhost; 16 | 17 | root /home/frappe/frappe-bench/sites; 18 | 19 | location /assets { 20 | try_files $uri =404; 21 | } 22 | 23 | location ~ ^/protected/(.*) { 24 | internal; 25 | try_files /$host/$1 =404; 26 | } 27 | 28 | location /socket.io { 29 | proxy_http_version 1.1; 30 | proxy_set_header Upgrade $http_upgrade; 31 | proxy_set_header Connection "upgrade"; 32 | proxy_set_header X-Frappe-Site-Name $host; 33 | proxy_set_header Origin $scheme://$http_host; 34 | proxy_set_header Host $host; 35 | 36 | proxy_pass http://bench-socketio-server; 37 | } 38 | 39 | location / { 40 | try_files /$host/public/$uri @webserver; 41 | } 42 | 43 | location @webserver { 44 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 | proxy_set_header X-Forwarded-Proto $scheme; 46 | proxy_set_header X-Frappe-Site-Name $host; 47 | proxy_set_header Host $host; 48 | proxy_set_header X-Use-X-Accel-Redirect True; 49 | proxy_read_timeout 600; 50 | proxy_redirect off; 51 | 52 | proxy_pass http://bench-frappe; 53 | } 54 | 55 | # error pages 56 | error_page 502 /502.html; 57 | location /502.html { 58 | root /home/frappe/bench-repo/bench/config/templates; 59 | internal; 60 | } 61 | 62 | # optimizations 63 | sendfile on; 64 | keepalive_timeout 15; 65 | client_max_body_size 50m; 66 | client_body_buffer_size 16K; 67 | client_header_buffer_size 1k; 68 | 69 | # enable gzip compresion 70 | # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge 71 | gzip on; 72 | gzip_http_version 1.1; 73 | gzip_comp_level 5; 74 | gzip_min_length 256; 75 | gzip_proxied any; 76 | gzip_vary on; 77 | gzip_types 78 | application/atom+xml 79 | application/javascript 80 | application/json 81 | application/rss+xml 82 | application/vnd.ms-fontobject 83 | application/x-font-ttf 84 | application/font-woff 85 | application/x-web-app-manifest+json 86 | application/xhtml+xml 87 | application/xml 88 | font/opentype 89 | image/svg+xml 90 | image/x-icon 91 | text/css 92 | text/plain 93 | text/x-component 94 | ; 95 | # text/html is always compressed by HttpGzipModule 96 | } 97 | -------------------------------------------------------------------------------- /images/12/debian/redis_cache.conf: -------------------------------------------------------------------------------- 1 | dbfilename redis_cache.rdb 2 | bind 0.0.0.0 3 | port 6379 4 | maxmemory 292mb 5 | maxmemory-policy allkeys-lru 6 | appendonly no 7 | 8 | save "" -------------------------------------------------------------------------------- /images/12/debian/test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM monogramm/docker-erpnext:12-alpine 2 | 3 | COPY docker_test.sh /docker_test.sh 4 | 5 | RUN set -ex; \ 6 | sudo chmod 755 /docker_test.sh; 7 | 8 | CMD ["/docker_test.sh"] 9 | -------------------------------------------------------------------------------- /images/13/alpine/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files during docker build 2 | 3 | # Docker-compose 4 | docker-compose.yml 5 | .env 6 | 7 | # DockerHub hooks 8 | hooks 9 | .dockertags 10 | 11 | # Custom configuration for tests 12 | redis_cache.conf 13 | nginx.conf 14 | -------------------------------------------------------------------------------- /images/13/alpine/.dockertags: -------------------------------------------------------------------------------- 1 | 13.5.0-alpine 13.5-alpine 13-alpine alpine 13.5.0 13.5 13 latest 2 | -------------------------------------------------------------------------------- /images/13/alpine/.env: -------------------------------------------------------------------------------- 1 | 2 | ######################################## 3 | # ERPNext configuration 4 | ######################################## 5 | 6 | ERPNEXT_SITE=localhost 7 | ERPNEXT_MAIL_HOST=mail 8 | 9 | ERPNEXT_ADMIN_PWD=erpnext_admin_password 10 | 11 | # Generated with openssl rand -base64 32 12 | ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic= 13 | 14 | ERPNEXT_DB_ROOT_LOGIN=root 15 | ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password 16 | 17 | # DB name will be used as the DB user 18 | ERPNEXT_DB_NAME=erpnext 19 | ERPNEXT_DB_PWD=erpnext_password 20 | 21 | ERPNEXT_SMTP_USER=erpnext 22 | ERPNEXT_SMTP_PWD=docker-erpnext 23 | 24 | -------------------------------------------------------------------------------- /images/13/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:13-alpine 19 | 20 | ARG VERSION=v13.5.0 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | sudo apk add python3-dev py3-setuptools; \ 36 | export PATH=/home/$FRAPPE_USER/.local/bin:$PATH; \ 37 | pip3 install Cython==0.29.10; \ 38 | pip3 install numpy==1.17.4; \ 39 | pip3 install pandas==0.24.2; \ 40 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext 41 | 42 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 43 | 44 | ARG TAG 45 | ARG VCS_REF 46 | ARG BUILD_DATE 47 | 48 | # Build environment variables 49 | ENV DOCKER_TAG=${TAG} \ 50 | DOCKER_VCS_REF=${VCS_REF} \ 51 | DOCKER_BUILD_DATE=${BUILD_DATE} 52 | 53 | LABEL maintainer="Monogramm Maintainers " \ 54 | product="ERPNext" \ 55 | version=$VERSION \ 56 | org.label-schema.vcs-ref=$VCS_REF \ 57 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 58 | org.label-schema.build-date=$BUILD_DATE \ 59 | org.label-schema.name="ERPNext" \ 60 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 61 | org.label-schema.url="https://erpnext.com/" \ 62 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 63 | org.label-schema.version=$VERSION \ 64 | org.label-schema.schema-version="1.0" 65 | -------------------------------------------------------------------------------- /images/13/alpine/hooks/README.md: -------------------------------------------------------------------------------- 1 | # DockerHub automated tests hooks 2 | 3 | See documentation for details: 4 | -------------------------------------------------------------------------------- /images/13/alpine/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker build \ 7 | --build-arg "TAG=${DOCKER_TAG}" \ 8 | --build-arg "VCS_REF=$(git rev-parse --short HEAD)" \ 9 | --build-arg "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 10 | -f "$DOCKERFILE_PATH" \ 11 | -t "$IMAGE_NAME" . 12 | -------------------------------------------------------------------------------- /images/13/alpine/hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_REGISTRY}" ]; then 7 | export DOCKER_BASE_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPO} 8 | else 9 | export DOCKER_BASE_IMAGE=${DOCKER_REPO} 10 | fi 11 | 12 | if [ -f ./.dockertags ]; then 13 | for tag in $(cat ./.dockertags); do 14 | if [ ! "${tag}" = "${DOCKER_TAG}" ]; then 15 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$tag" 16 | docker push "$DOCKER_BASE_IMAGE:$tag" 17 | fi 18 | done 19 | fi 20 | 21 | # Push image with tag set to commit hash 22 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 23 | docker push "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 24 | 25 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 26 | if [ -n "${DOCKER_REGISTRY}" ]; then 27 | echo "Logout of Docker Registry ${DOCKER_REGISTRY}..." 28 | docker logout "${DOCKER_REGISTRY}" 29 | else 30 | echo "Logout of Docker default Registry..." 31 | docker logout 32 | fi 33 | fi 34 | -------------------------------------------------------------------------------- /images/13/alpine/hooks/post_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Removing persisted data...' 7 | #rm -rf '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | -------------------------------------------------------------------------------- /images/13/alpine/hooks/pre_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 7 | if [ -n "${DOCKER_REGISTRY}" ]; then 8 | echo "Login to Docker Registry ${DOCKER_REGISTRY}..." 9 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}" 10 | else 11 | echo "Login to Docker default Registry..." 12 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /images/13/alpine/hooks/pre_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Set permissions for persisted data...' 7 | #mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | #chown "1000:1000" '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 9 | #chmod 777 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 10 | -------------------------------------------------------------------------------- /images/13/alpine/hooks/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker push "$IMAGE_NAME" 7 | -------------------------------------------------------------------------------- /images/13/alpine/hooks/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Custom script to run locally DockerHub hooks 4 | # See documentation for details: 5 | # https://docs.docker.com/docker-hub/builds/advanced/ 6 | 7 | echo "Custom script to run locally DockerHub hooks..." 8 | set -e 9 | 10 | export SOURCE_BRANCH 11 | SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) 12 | export SOURCE_COMMIT 13 | SOURCE_COMMIT=$(git rev-parse --short HEAD) 14 | export COMMIT_MSG 15 | COMMIT_MSG=$(git log -1 --format=%s) 16 | 17 | export DOCKER_REPO=monogramm/docker-erpnext 18 | export DOCKERFILE_PATH=Dockerfile 19 | export DOCKER_TAG=13.5 20 | 21 | if [ -n "${DOCKER_REGISTRY}" ]; then 22 | export IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG} 23 | else 24 | export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG} 25 | fi 26 | 27 | # Execute hooks in given order 28 | IFS=',' read -ra STEPS <<< "${1:-build,test}" 29 | for step in "${STEPS[@]}" 30 | do 31 | for hook in "pre_${step}" "${step}" "post_${step}"; do 32 | if [ -f "./hooks/${hook}" ]; then 33 | echo "Executing ${hook} hook..." 34 | "./hooks/${hook}" 35 | fi 36 | done 37 | done 38 | 39 | echo "DockerHub hooks finished" 40 | -------------------------------------------------------------------------------- /images/13/alpine/hooks/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | for file in docker-compose*.test.yml; do 7 | 8 | echo "Starting Test in ${file}..." 9 | 10 | # Build test container 11 | docker-compose --no-ansi -f "${file}" build sut 12 | # Test container run 13 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 14 | docker-compose --no-ansi -f "${file}" logs -f "sut" 15 | docker-compose --no-ansi -f "${file}" ps 16 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 17 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 18 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 19 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 20 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 21 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 22 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 23 | docker-compose --no-ansi -f "${file}" down 24 | # Test container restart 25 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 26 | docker-compose --no-ansi -f "${file}" logs -f "sut" 27 | docker-compose --no-ansi -f "${file}" ps 28 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 29 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 30 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 31 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 32 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 33 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 34 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 35 | docker-compose --no-ansi -f "${file}" down --volumes 36 | 37 | done 38 | -------------------------------------------------------------------------------- /images/13/alpine/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | upstream bench-frappe { 3 | # Call App container from Docker network 4 | server erpnext_app:8000 fail_timeout=0; 5 | } 6 | 7 | upstream bench-socketio-server { 8 | # Call Socketio container from Docker network 9 | server erpnext_socketio:3000 fail_timeout=0; 10 | } 11 | 12 | server { 13 | listen 80; 14 | 15 | server_name localhost; 16 | 17 | root /home/frappe/frappe-bench/sites; 18 | 19 | location /assets { 20 | try_files $uri =404; 21 | } 22 | 23 | location ~ ^/protected/(.*) { 24 | internal; 25 | try_files /$host/$1 =404; 26 | } 27 | 28 | location /socket.io { 29 | proxy_http_version 1.1; 30 | proxy_set_header Upgrade $http_upgrade; 31 | proxy_set_header Connection "upgrade"; 32 | proxy_set_header X-Frappe-Site-Name $host; 33 | proxy_set_header Origin $scheme://$http_host; 34 | proxy_set_header Host $host; 35 | 36 | proxy_pass http://bench-socketio-server; 37 | } 38 | 39 | location / { 40 | try_files /$host/public/$uri @webserver; 41 | } 42 | 43 | location @webserver { 44 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 | proxy_set_header X-Forwarded-Proto $scheme; 46 | proxy_set_header X-Frappe-Site-Name $host; 47 | proxy_set_header Host $host; 48 | proxy_set_header X-Use-X-Accel-Redirect True; 49 | proxy_read_timeout 600; 50 | proxy_redirect off; 51 | 52 | proxy_pass http://bench-frappe; 53 | } 54 | 55 | # error pages 56 | error_page 502 /502.html; 57 | location /502.html { 58 | root /home/frappe/bench-repo/bench/config/templates; 59 | internal; 60 | } 61 | 62 | # optimizations 63 | sendfile on; 64 | keepalive_timeout 15; 65 | client_max_body_size 50m; 66 | client_body_buffer_size 16K; 67 | client_header_buffer_size 1k; 68 | 69 | # enable gzip compresion 70 | # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge 71 | gzip on; 72 | gzip_http_version 1.1; 73 | gzip_comp_level 5; 74 | gzip_min_length 256; 75 | gzip_proxied any; 76 | gzip_vary on; 77 | gzip_types 78 | application/atom+xml 79 | application/javascript 80 | application/json 81 | application/rss+xml 82 | application/vnd.ms-fontobject 83 | application/x-font-ttf 84 | application/font-woff 85 | application/x-web-app-manifest+json 86 | application/xhtml+xml 87 | application/xml 88 | font/opentype 89 | image/svg+xml 90 | image/x-icon 91 | text/css 92 | text/plain 93 | text/x-component 94 | ; 95 | # text/html is always compressed by HttpGzipModule 96 | } 97 | -------------------------------------------------------------------------------- /images/13/alpine/redis_cache.conf: -------------------------------------------------------------------------------- 1 | dbfilename redis_cache.rdb 2 | bind 0.0.0.0 3 | port 6379 4 | maxmemory 292mb 5 | maxmemory-policy allkeys-lru 6 | appendonly no 7 | 8 | save "" -------------------------------------------------------------------------------- /images/13/alpine/test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM monogramm/docker-erpnext:13-alpine 2 | 3 | COPY docker_test.sh /docker_test.sh 4 | 5 | RUN set -ex; \ 6 | sudo chmod 755 /docker_test.sh; 7 | 8 | CMD ["/docker_test.sh"] 9 | -------------------------------------------------------------------------------- /images/13/debian-slim/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files during docker build 2 | 3 | # Docker-compose 4 | docker-compose.yml 5 | .env 6 | 7 | # DockerHub hooks 8 | hooks 9 | .dockertags 10 | 11 | # Custom configuration for tests 12 | redis_cache.conf 13 | nginx.conf 14 | -------------------------------------------------------------------------------- /images/13/debian-slim/.dockertags: -------------------------------------------------------------------------------- 1 | 13.5.0-debian-slim 13.5-debian-slim 13-debian-slim debian-slim 2 | -------------------------------------------------------------------------------- /images/13/debian-slim/.env: -------------------------------------------------------------------------------- 1 | 2 | ######################################## 3 | # ERPNext configuration 4 | ######################################## 5 | 6 | ERPNEXT_SITE=localhost 7 | ERPNEXT_MAIL_HOST=mail 8 | 9 | ERPNEXT_ADMIN_PWD=erpnext_admin_password 10 | 11 | # Generated with openssl rand -base64 32 12 | ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic= 13 | 14 | ERPNEXT_DB_ROOT_LOGIN=root 15 | ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password 16 | 17 | # DB name will be used as the DB user 18 | ERPNEXT_DB_NAME=erpnext 19 | ERPNEXT_DB_PWD=erpnext_password 20 | 21 | ERPNEXT_SMTP_USER=erpnext 22 | ERPNEXT_SMTP_PWD=docker-erpnext 23 | 24 | -------------------------------------------------------------------------------- /images/13/debian-slim/Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:13-debian-slim 19 | 20 | ARG VERSION=v13.5.0 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext; \ 36 | sudo ./env/bin/pip3 install \ 37 | ldap3 \ 38 | ; 39 | 40 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 41 | 42 | ARG TAG 43 | ARG VCS_REF 44 | ARG BUILD_DATE 45 | 46 | # Build environment variables 47 | ENV DOCKER_TAG=${TAG} \ 48 | DOCKER_VCS_REF=${VCS_REF} \ 49 | DOCKER_BUILD_DATE=${BUILD_DATE} 50 | 51 | LABEL maintainer="Monogramm Maintainers " \ 52 | product="ERPNext" \ 53 | version=$VERSION \ 54 | org.label-schema.vcs-ref=$VCS_REF \ 55 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 56 | org.label-schema.build-date=$BUILD_DATE \ 57 | org.label-schema.name="ERPNext" \ 58 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 59 | org.label-schema.url="https://erpnext.com/" \ 60 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 61 | org.label-schema.version=$VERSION \ 62 | org.label-schema.schema-version="1.0" 63 | -------------------------------------------------------------------------------- /images/13/debian-slim/hooks/README.md: -------------------------------------------------------------------------------- 1 | # DockerHub automated tests hooks 2 | 3 | See documentation for details: 4 | -------------------------------------------------------------------------------- /images/13/debian-slim/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker build \ 7 | --build-arg "TAG=${DOCKER_TAG}" \ 8 | --build-arg "VCS_REF=$(git rev-parse --short HEAD)" \ 9 | --build-arg "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 10 | -f "$DOCKERFILE_PATH" \ 11 | -t "$IMAGE_NAME" . 12 | -------------------------------------------------------------------------------- /images/13/debian-slim/hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_REGISTRY}" ]; then 7 | export DOCKER_BASE_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPO} 8 | else 9 | export DOCKER_BASE_IMAGE=${DOCKER_REPO} 10 | fi 11 | 12 | if [ -f ./.dockertags ]; then 13 | for tag in $(cat ./.dockertags); do 14 | if [ ! "${tag}" = "${DOCKER_TAG}" ]; then 15 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$tag" 16 | docker push "$DOCKER_BASE_IMAGE:$tag" 17 | fi 18 | done 19 | fi 20 | 21 | # Push image with tag set to commit hash 22 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 23 | docker push "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 24 | 25 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 26 | if [ -n "${DOCKER_REGISTRY}" ]; then 27 | echo "Logout of Docker Registry ${DOCKER_REGISTRY}..." 28 | docker logout "${DOCKER_REGISTRY}" 29 | else 30 | echo "Logout of Docker default Registry..." 31 | docker logout 32 | fi 33 | fi 34 | -------------------------------------------------------------------------------- /images/13/debian-slim/hooks/post_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Removing persisted data...' 7 | #rm -rf '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | -------------------------------------------------------------------------------- /images/13/debian-slim/hooks/pre_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 7 | if [ -n "${DOCKER_REGISTRY}" ]; then 8 | echo "Login to Docker Registry ${DOCKER_REGISTRY}..." 9 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}" 10 | else 11 | echo "Login to Docker default Registry..." 12 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /images/13/debian-slim/hooks/pre_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Set permissions for persisted data...' 7 | #mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | #chown "1000:1000" '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 9 | #chmod 777 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 10 | -------------------------------------------------------------------------------- /images/13/debian-slim/hooks/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker push "$IMAGE_NAME" 7 | -------------------------------------------------------------------------------- /images/13/debian-slim/hooks/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Custom script to run locally DockerHub hooks 4 | # See documentation for details: 5 | # https://docs.docker.com/docker-hub/builds/advanced/ 6 | 7 | echo "Custom script to run locally DockerHub hooks..." 8 | set -e 9 | 10 | export SOURCE_BRANCH 11 | SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) 12 | export SOURCE_COMMIT 13 | SOURCE_COMMIT=$(git rev-parse --short HEAD) 14 | export COMMIT_MSG 15 | COMMIT_MSG=$(git log -1 --format=%s) 16 | 17 | export DOCKER_REPO=monogramm/docker-erpnext 18 | export DOCKERFILE_PATH=Dockerfile 19 | export DOCKER_TAG=13.5 20 | 21 | if [ -n "${DOCKER_REGISTRY}" ]; then 22 | export IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG} 23 | else 24 | export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG} 25 | fi 26 | 27 | # Execute hooks in given order 28 | IFS=',' read -ra STEPS <<< "${1:-build,test}" 29 | for step in "${STEPS[@]}" 30 | do 31 | for hook in "pre_${step}" "${step}" "post_${step}"; do 32 | if [ -f "./hooks/${hook}" ]; then 33 | echo "Executing ${hook} hook..." 34 | "./hooks/${hook}" 35 | fi 36 | done 37 | done 38 | 39 | echo "DockerHub hooks finished" 40 | -------------------------------------------------------------------------------- /images/13/debian-slim/hooks/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | for file in docker-compose*.test.yml; do 7 | 8 | echo "Starting Test in ${file}..." 9 | 10 | # Build test container 11 | docker-compose --no-ansi -f "${file}" build sut 12 | # Test container run 13 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 14 | docker-compose --no-ansi -f "${file}" logs -f "sut" 15 | docker-compose --no-ansi -f "${file}" ps 16 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 17 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 18 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 19 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 20 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 21 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 22 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 23 | docker-compose --no-ansi -f "${file}" down 24 | # Test container restart 25 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 26 | docker-compose --no-ansi -f "${file}" logs -f "sut" 27 | docker-compose --no-ansi -f "${file}" ps 28 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 29 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 30 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 31 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 32 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 33 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 34 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 35 | docker-compose --no-ansi -f "${file}" down --volumes 36 | 37 | done 38 | -------------------------------------------------------------------------------- /images/13/debian-slim/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | upstream bench-frappe { 3 | # Call App container from Docker network 4 | server erpnext_app:8000 fail_timeout=0; 5 | } 6 | 7 | upstream bench-socketio-server { 8 | # Call Socketio container from Docker network 9 | server erpnext_socketio:3000 fail_timeout=0; 10 | } 11 | 12 | server { 13 | listen 80; 14 | 15 | server_name localhost; 16 | 17 | root /home/frappe/frappe-bench/sites; 18 | 19 | location /assets { 20 | try_files $uri =404; 21 | } 22 | 23 | location ~ ^/protected/(.*) { 24 | internal; 25 | try_files /$host/$1 =404; 26 | } 27 | 28 | location /socket.io { 29 | proxy_http_version 1.1; 30 | proxy_set_header Upgrade $http_upgrade; 31 | proxy_set_header Connection "upgrade"; 32 | proxy_set_header X-Frappe-Site-Name $host; 33 | proxy_set_header Origin $scheme://$http_host; 34 | proxy_set_header Host $host; 35 | 36 | proxy_pass http://bench-socketio-server; 37 | } 38 | 39 | location / { 40 | try_files /$host/public/$uri @webserver; 41 | } 42 | 43 | location @webserver { 44 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 | proxy_set_header X-Forwarded-Proto $scheme; 46 | proxy_set_header X-Frappe-Site-Name $host; 47 | proxy_set_header Host $host; 48 | proxy_set_header X-Use-X-Accel-Redirect True; 49 | proxy_read_timeout 600; 50 | proxy_redirect off; 51 | 52 | proxy_pass http://bench-frappe; 53 | } 54 | 55 | # error pages 56 | error_page 502 /502.html; 57 | location /502.html { 58 | root /home/frappe/bench-repo/bench/config/templates; 59 | internal; 60 | } 61 | 62 | # optimizations 63 | sendfile on; 64 | keepalive_timeout 15; 65 | client_max_body_size 50m; 66 | client_body_buffer_size 16K; 67 | client_header_buffer_size 1k; 68 | 69 | # enable gzip compresion 70 | # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge 71 | gzip on; 72 | gzip_http_version 1.1; 73 | gzip_comp_level 5; 74 | gzip_min_length 256; 75 | gzip_proxied any; 76 | gzip_vary on; 77 | gzip_types 78 | application/atom+xml 79 | application/javascript 80 | application/json 81 | application/rss+xml 82 | application/vnd.ms-fontobject 83 | application/x-font-ttf 84 | application/font-woff 85 | application/x-web-app-manifest+json 86 | application/xhtml+xml 87 | application/xml 88 | font/opentype 89 | image/svg+xml 90 | image/x-icon 91 | text/css 92 | text/plain 93 | text/x-component 94 | ; 95 | # text/html is always compressed by HttpGzipModule 96 | } 97 | -------------------------------------------------------------------------------- /images/13/debian-slim/redis_cache.conf: -------------------------------------------------------------------------------- 1 | dbfilename redis_cache.rdb 2 | bind 0.0.0.0 3 | port 6379 4 | maxmemory 292mb 5 | maxmemory-policy allkeys-lru 6 | appendonly no 7 | 8 | save "" -------------------------------------------------------------------------------- /images/13/debian-slim/test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM monogramm/docker-erpnext:13-alpine 2 | 3 | COPY docker_test.sh /docker_test.sh 4 | 5 | RUN set -ex; \ 6 | sudo chmod 755 /docker_test.sh; 7 | 8 | CMD ["/docker_test.sh"] 9 | -------------------------------------------------------------------------------- /images/13/debian/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files during docker build 2 | 3 | # Docker-compose 4 | docker-compose.yml 5 | .env 6 | 7 | # DockerHub hooks 8 | hooks 9 | .dockertags 10 | 11 | # Custom configuration for tests 12 | redis_cache.conf 13 | nginx.conf 14 | -------------------------------------------------------------------------------- /images/13/debian/.dockertags: -------------------------------------------------------------------------------- 1 | 13.5.0-debian 13.5-debian 13-debian debian 2 | -------------------------------------------------------------------------------- /images/13/debian/.env: -------------------------------------------------------------------------------- 1 | 2 | ######################################## 3 | # ERPNext configuration 4 | ######################################## 5 | 6 | ERPNEXT_SITE=localhost 7 | ERPNEXT_MAIL_HOST=mail 8 | 9 | ERPNEXT_ADMIN_PWD=erpnext_admin_password 10 | 11 | # Generated with openssl rand -base64 32 12 | ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic= 13 | 14 | ERPNEXT_DB_ROOT_LOGIN=root 15 | ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password 16 | 17 | # DB name will be used as the DB user 18 | ERPNEXT_DB_NAME=erpnext 19 | ERPNEXT_DB_PWD=erpnext_password 20 | 21 | ERPNEXT_SMTP_USER=erpnext 22 | ERPNEXT_SMTP_PWD=docker-erpnext 23 | 24 | -------------------------------------------------------------------------------- /images/13/debian/Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:13-debian 19 | 20 | ARG VERSION=v13.5.0 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext; \ 36 | sudo ./env/bin/pip3 install \ 37 | ldap3 \ 38 | ; 39 | 40 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 41 | 42 | ARG TAG 43 | ARG VCS_REF 44 | ARG BUILD_DATE 45 | 46 | # Build environment variables 47 | ENV DOCKER_TAG=${TAG} \ 48 | DOCKER_VCS_REF=${VCS_REF} \ 49 | DOCKER_BUILD_DATE=${BUILD_DATE} 50 | 51 | LABEL maintainer="Monogramm Maintainers " \ 52 | product="ERPNext" \ 53 | version=$VERSION \ 54 | org.label-schema.vcs-ref=$VCS_REF \ 55 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 56 | org.label-schema.build-date=$BUILD_DATE \ 57 | org.label-schema.name="ERPNext" \ 58 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 59 | org.label-schema.url="https://erpnext.com/" \ 60 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 61 | org.label-schema.version=$VERSION \ 62 | org.label-schema.schema-version="1.0" 63 | -------------------------------------------------------------------------------- /images/13/debian/hooks/README.md: -------------------------------------------------------------------------------- 1 | # DockerHub automated tests hooks 2 | 3 | See documentation for details: 4 | -------------------------------------------------------------------------------- /images/13/debian/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker build \ 7 | --build-arg "TAG=${DOCKER_TAG}" \ 8 | --build-arg "VCS_REF=$(git rev-parse --short HEAD)" \ 9 | --build-arg "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 10 | -f "$DOCKERFILE_PATH" \ 11 | -t "$IMAGE_NAME" . 12 | -------------------------------------------------------------------------------- /images/13/debian/hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_REGISTRY}" ]; then 7 | export DOCKER_BASE_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPO} 8 | else 9 | export DOCKER_BASE_IMAGE=${DOCKER_REPO} 10 | fi 11 | 12 | if [ -f ./.dockertags ]; then 13 | for tag in $(cat ./.dockertags); do 14 | if [ ! "${tag}" = "${DOCKER_TAG}" ]; then 15 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$tag" 16 | docker push "$DOCKER_BASE_IMAGE:$tag" 17 | fi 18 | done 19 | fi 20 | 21 | # Push image with tag set to commit hash 22 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 23 | docker push "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 24 | 25 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 26 | if [ -n "${DOCKER_REGISTRY}" ]; then 27 | echo "Logout of Docker Registry ${DOCKER_REGISTRY}..." 28 | docker logout "${DOCKER_REGISTRY}" 29 | else 30 | echo "Logout of Docker default Registry..." 31 | docker logout 32 | fi 33 | fi 34 | -------------------------------------------------------------------------------- /images/13/debian/hooks/post_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Removing persisted data...' 7 | #rm -rf '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | -------------------------------------------------------------------------------- /images/13/debian/hooks/pre_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 7 | if [ -n "${DOCKER_REGISTRY}" ]; then 8 | echo "Login to Docker Registry ${DOCKER_REGISTRY}..." 9 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}" 10 | else 11 | echo "Login to Docker default Registry..." 12 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /images/13/debian/hooks/pre_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Set permissions for persisted data...' 7 | #mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | #chown "1000:1000" '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 9 | #chmod 777 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 10 | -------------------------------------------------------------------------------- /images/13/debian/hooks/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker push "$IMAGE_NAME" 7 | -------------------------------------------------------------------------------- /images/13/debian/hooks/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Custom script to run locally DockerHub hooks 4 | # See documentation for details: 5 | # https://docs.docker.com/docker-hub/builds/advanced/ 6 | 7 | echo "Custom script to run locally DockerHub hooks..." 8 | set -e 9 | 10 | export SOURCE_BRANCH 11 | SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) 12 | export SOURCE_COMMIT 13 | SOURCE_COMMIT=$(git rev-parse --short HEAD) 14 | export COMMIT_MSG 15 | COMMIT_MSG=$(git log -1 --format=%s) 16 | 17 | export DOCKER_REPO=monogramm/docker-erpnext 18 | export DOCKERFILE_PATH=Dockerfile 19 | export DOCKER_TAG=13.5 20 | 21 | if [ -n "${DOCKER_REGISTRY}" ]; then 22 | export IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG} 23 | else 24 | export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG} 25 | fi 26 | 27 | # Execute hooks in given order 28 | IFS=',' read -ra STEPS <<< "${1:-build,test}" 29 | for step in "${STEPS[@]}" 30 | do 31 | for hook in "pre_${step}" "${step}" "post_${step}"; do 32 | if [ -f "./hooks/${hook}" ]; then 33 | echo "Executing ${hook} hook..." 34 | "./hooks/${hook}" 35 | fi 36 | done 37 | done 38 | 39 | echo "DockerHub hooks finished" 40 | -------------------------------------------------------------------------------- /images/13/debian/hooks/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | for file in docker-compose*.test.yml; do 7 | 8 | echo "Starting Test in ${file}..." 9 | 10 | # Build test container 11 | docker-compose --no-ansi -f "${file}" build sut 12 | # Test container run 13 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 14 | docker-compose --no-ansi -f "${file}" logs -f "sut" 15 | docker-compose --no-ansi -f "${file}" ps 16 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 17 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 18 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 19 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 20 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 21 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 22 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 23 | docker-compose --no-ansi -f "${file}" down 24 | # Test container restart 25 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 26 | docker-compose --no-ansi -f "${file}" logs -f "sut" 27 | docker-compose --no-ansi -f "${file}" ps 28 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 29 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 30 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 31 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 32 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 33 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 34 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 35 | docker-compose --no-ansi -f "${file}" down --volumes 36 | 37 | done 38 | -------------------------------------------------------------------------------- /images/13/debian/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | upstream bench-frappe { 3 | # Call App container from Docker network 4 | server erpnext_app:8000 fail_timeout=0; 5 | } 6 | 7 | upstream bench-socketio-server { 8 | # Call Socketio container from Docker network 9 | server erpnext_socketio:3000 fail_timeout=0; 10 | } 11 | 12 | server { 13 | listen 80; 14 | 15 | server_name localhost; 16 | 17 | root /home/frappe/frappe-bench/sites; 18 | 19 | location /assets { 20 | try_files $uri =404; 21 | } 22 | 23 | location ~ ^/protected/(.*) { 24 | internal; 25 | try_files /$host/$1 =404; 26 | } 27 | 28 | location /socket.io { 29 | proxy_http_version 1.1; 30 | proxy_set_header Upgrade $http_upgrade; 31 | proxy_set_header Connection "upgrade"; 32 | proxy_set_header X-Frappe-Site-Name $host; 33 | proxy_set_header Origin $scheme://$http_host; 34 | proxy_set_header Host $host; 35 | 36 | proxy_pass http://bench-socketio-server; 37 | } 38 | 39 | location / { 40 | try_files /$host/public/$uri @webserver; 41 | } 42 | 43 | location @webserver { 44 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 | proxy_set_header X-Forwarded-Proto $scheme; 46 | proxy_set_header X-Frappe-Site-Name $host; 47 | proxy_set_header Host $host; 48 | proxy_set_header X-Use-X-Accel-Redirect True; 49 | proxy_read_timeout 600; 50 | proxy_redirect off; 51 | 52 | proxy_pass http://bench-frappe; 53 | } 54 | 55 | # error pages 56 | error_page 502 /502.html; 57 | location /502.html { 58 | root /home/frappe/bench-repo/bench/config/templates; 59 | internal; 60 | } 61 | 62 | # optimizations 63 | sendfile on; 64 | keepalive_timeout 15; 65 | client_max_body_size 50m; 66 | client_body_buffer_size 16K; 67 | client_header_buffer_size 1k; 68 | 69 | # enable gzip compresion 70 | # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge 71 | gzip on; 72 | gzip_http_version 1.1; 73 | gzip_comp_level 5; 74 | gzip_min_length 256; 75 | gzip_proxied any; 76 | gzip_vary on; 77 | gzip_types 78 | application/atom+xml 79 | application/javascript 80 | application/json 81 | application/rss+xml 82 | application/vnd.ms-fontobject 83 | application/x-font-ttf 84 | application/font-woff 85 | application/x-web-app-manifest+json 86 | application/xhtml+xml 87 | application/xml 88 | font/opentype 89 | image/svg+xml 90 | image/x-icon 91 | text/css 92 | text/plain 93 | text/x-component 94 | ; 95 | # text/html is always compressed by HttpGzipModule 96 | } 97 | -------------------------------------------------------------------------------- /images/13/debian/redis_cache.conf: -------------------------------------------------------------------------------- 1 | dbfilename redis_cache.rdb 2 | bind 0.0.0.0 3 | port 6379 4 | maxmemory 292mb 5 | maxmemory-policy allkeys-lru 6 | appendonly no 7 | 8 | save "" -------------------------------------------------------------------------------- /images/13/debian/test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM monogramm/docker-erpnext:13-alpine 2 | 3 | COPY docker_test.sh /docker_test.sh 4 | 5 | RUN set -ex; \ 6 | sudo chmod 755 /docker_test.sh; 7 | 8 | CMD ["/docker_test.sh"] 9 | -------------------------------------------------------------------------------- /images/develop/alpine/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files during docker build 2 | 3 | # Docker-compose 4 | docker-compose.yml 5 | .env 6 | 7 | # DockerHub hooks 8 | hooks 9 | .dockertags 10 | 11 | # Custom configuration for tests 12 | redis_cache.conf 13 | nginx.conf 14 | -------------------------------------------------------------------------------- /images/develop/alpine/.dockertags: -------------------------------------------------------------------------------- 1 | develop-alpine develop 2 | -------------------------------------------------------------------------------- /images/develop/alpine/.env: -------------------------------------------------------------------------------- 1 | 2 | ######################################## 3 | # ERPNext configuration 4 | ######################################## 5 | 6 | ERPNEXT_SITE=localhost 7 | ERPNEXT_MAIL_HOST=mail 8 | 9 | ERPNEXT_ADMIN_PWD=erpnext_admin_password 10 | 11 | # Generated with openssl rand -base64 32 12 | ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic= 13 | 14 | ERPNEXT_DB_ROOT_LOGIN=root 15 | ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password 16 | 17 | # DB name will be used as the DB user 18 | ERPNEXT_DB_NAME=erpnext 19 | ERPNEXT_DB_PWD=erpnext_password 20 | 21 | ERPNEXT_SMTP_USER=erpnext 22 | ERPNEXT_SMTP_PWD=docker-erpnext 23 | 24 | -------------------------------------------------------------------------------- /images/develop/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:develop-alpine 19 | 20 | ARG VERSION=develop 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | sudo apk add python3-dev py3-setuptools; \ 36 | export PATH=/home/$FRAPPE_USER/.local/bin:$PATH; \ 37 | pip3 install Cython==0.29.10; \ 38 | pip3 install numpy==1.17.4; \ 39 | pip3 install pandas==0.24.2; \ 40 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext 41 | 42 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 43 | 44 | ARG TAG 45 | ARG VCS_REF 46 | ARG BUILD_DATE 47 | 48 | # Build environment variables 49 | ENV DOCKER_TAG=${TAG} \ 50 | DOCKER_VCS_REF=${VCS_REF} \ 51 | DOCKER_BUILD_DATE=${BUILD_DATE} 52 | 53 | LABEL maintainer="Monogramm Maintainers " \ 54 | product="ERPNext" \ 55 | version=$VERSION \ 56 | org.label-schema.vcs-ref=$VCS_REF \ 57 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 58 | org.label-schema.build-date=$BUILD_DATE \ 59 | org.label-schema.name="ERPNext" \ 60 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 61 | org.label-schema.url="https://erpnext.com/" \ 62 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 63 | org.label-schema.version=$VERSION \ 64 | org.label-schema.schema-version="1.0" 65 | -------------------------------------------------------------------------------- /images/develop/alpine/hooks/README.md: -------------------------------------------------------------------------------- 1 | # DockerHub automated tests hooks 2 | 3 | See documentation for details: 4 | -------------------------------------------------------------------------------- /images/develop/alpine/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker build \ 7 | --build-arg "TAG=${DOCKER_TAG}" \ 8 | --build-arg "VCS_REF=$(git rev-parse --short HEAD)" \ 9 | --build-arg "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 10 | -f "$DOCKERFILE_PATH" \ 11 | -t "$IMAGE_NAME" . 12 | -------------------------------------------------------------------------------- /images/develop/alpine/hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_REGISTRY}" ]; then 7 | export DOCKER_BASE_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPO} 8 | else 9 | export DOCKER_BASE_IMAGE=${DOCKER_REPO} 10 | fi 11 | 12 | if [ -f ./.dockertags ]; then 13 | for tag in $(cat ./.dockertags); do 14 | if [ ! "${tag}" = "${DOCKER_TAG}" ]; then 15 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$tag" 16 | docker push "$DOCKER_BASE_IMAGE:$tag" 17 | fi 18 | done 19 | fi 20 | 21 | # Push image with tag set to commit hash 22 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 23 | docker push "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 24 | 25 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 26 | if [ -n "${DOCKER_REGISTRY}" ]; then 27 | echo "Logout of Docker Registry ${DOCKER_REGISTRY}..." 28 | docker logout "${DOCKER_REGISTRY}" 29 | else 30 | echo "Logout of Docker default Registry..." 31 | docker logout 32 | fi 33 | fi 34 | -------------------------------------------------------------------------------- /images/develop/alpine/hooks/post_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Removing persisted data...' 7 | #rm -rf '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | -------------------------------------------------------------------------------- /images/develop/alpine/hooks/pre_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 7 | if [ -n "${DOCKER_REGISTRY}" ]; then 8 | echo "Login to Docker Registry ${DOCKER_REGISTRY}..." 9 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}" 10 | else 11 | echo "Login to Docker default Registry..." 12 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /images/develop/alpine/hooks/pre_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Set permissions for persisted data...' 7 | #mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | #chown "1000:1000" '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 9 | #chmod 777 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 10 | -------------------------------------------------------------------------------- /images/develop/alpine/hooks/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker push "$IMAGE_NAME" 7 | -------------------------------------------------------------------------------- /images/develop/alpine/hooks/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Custom script to run locally DockerHub hooks 4 | # See documentation for details: 5 | # https://docs.docker.com/docker-hub/builds/advanced/ 6 | 7 | echo "Custom script to run locally DockerHub hooks..." 8 | set -e 9 | 10 | export SOURCE_BRANCH 11 | SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) 12 | export SOURCE_COMMIT 13 | SOURCE_COMMIT=$(git rev-parse --short HEAD) 14 | export COMMIT_MSG 15 | COMMIT_MSG=$(git log -1 --format=%s) 16 | 17 | export DOCKER_REPO=monogramm/docker-erpnext 18 | export DOCKERFILE_PATH=Dockerfile 19 | export DOCKER_TAG=develop 20 | 21 | if [ -n "${DOCKER_REGISTRY}" ]; then 22 | export IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG} 23 | else 24 | export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG} 25 | fi 26 | 27 | # Execute hooks in given order 28 | IFS=',' read -ra STEPS <<< "${1:-build,test}" 29 | for step in "${STEPS[@]}" 30 | do 31 | for hook in "pre_${step}" "${step}" "post_${step}"; do 32 | if [ -f "./hooks/${hook}" ]; then 33 | echo "Executing ${hook} hook..." 34 | "./hooks/${hook}" 35 | fi 36 | done 37 | done 38 | 39 | echo "DockerHub hooks finished" 40 | -------------------------------------------------------------------------------- /images/develop/alpine/hooks/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | for file in docker-compose*.test.yml; do 7 | 8 | echo "Starting Test in ${file}..." 9 | 10 | # Build test container 11 | docker-compose --no-ansi -f "${file}" build sut 12 | # Test container run 13 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 14 | docker-compose --no-ansi -f "${file}" logs -f "sut" 15 | docker-compose --no-ansi -f "${file}" ps 16 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 17 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 18 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 19 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 20 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 21 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 22 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 23 | docker-compose --no-ansi -f "${file}" down 24 | # Test container restart 25 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 26 | docker-compose --no-ansi -f "${file}" logs -f "sut" 27 | docker-compose --no-ansi -f "${file}" ps 28 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 29 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 30 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 31 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 32 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 33 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 34 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 35 | docker-compose --no-ansi -f "${file}" down --volumes 36 | 37 | done 38 | -------------------------------------------------------------------------------- /images/develop/alpine/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | upstream bench-frappe { 3 | # Call App container from Docker network 4 | server erpnext_app:8000 fail_timeout=0; 5 | } 6 | 7 | upstream bench-socketio-server { 8 | # Call Socketio container from Docker network 9 | server erpnext_socketio:3000 fail_timeout=0; 10 | } 11 | 12 | server { 13 | listen 80; 14 | 15 | server_name localhost; 16 | 17 | root /home/frappe/frappe-bench/sites; 18 | 19 | location /assets { 20 | try_files $uri =404; 21 | } 22 | 23 | location ~ ^/protected/(.*) { 24 | internal; 25 | try_files /$host/$1 =404; 26 | } 27 | 28 | location /socket.io { 29 | proxy_http_version 1.1; 30 | proxy_set_header Upgrade $http_upgrade; 31 | proxy_set_header Connection "upgrade"; 32 | proxy_set_header X-Frappe-Site-Name $host; 33 | proxy_set_header Origin $scheme://$http_host; 34 | proxy_set_header Host $host; 35 | 36 | proxy_pass http://bench-socketio-server; 37 | } 38 | 39 | location / { 40 | try_files /$host/public/$uri @webserver; 41 | } 42 | 43 | location @webserver { 44 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 | proxy_set_header X-Forwarded-Proto $scheme; 46 | proxy_set_header X-Frappe-Site-Name $host; 47 | proxy_set_header Host $host; 48 | proxy_set_header X-Use-X-Accel-Redirect True; 49 | proxy_read_timeout 600; 50 | proxy_redirect off; 51 | 52 | proxy_pass http://bench-frappe; 53 | } 54 | 55 | # error pages 56 | error_page 502 /502.html; 57 | location /502.html { 58 | root /home/frappe/bench-repo/bench/config/templates; 59 | internal; 60 | } 61 | 62 | # optimizations 63 | sendfile on; 64 | keepalive_timeout 15; 65 | client_max_body_size 50m; 66 | client_body_buffer_size 16K; 67 | client_header_buffer_size 1k; 68 | 69 | # enable gzip compresion 70 | # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge 71 | gzip on; 72 | gzip_http_version 1.1; 73 | gzip_comp_level 5; 74 | gzip_min_length 256; 75 | gzip_proxied any; 76 | gzip_vary on; 77 | gzip_types 78 | application/atom+xml 79 | application/javascript 80 | application/json 81 | application/rss+xml 82 | application/vnd.ms-fontobject 83 | application/x-font-ttf 84 | application/font-woff 85 | application/x-web-app-manifest+json 86 | application/xhtml+xml 87 | application/xml 88 | font/opentype 89 | image/svg+xml 90 | image/x-icon 91 | text/css 92 | text/plain 93 | text/x-component 94 | ; 95 | # text/html is always compressed by HttpGzipModule 96 | } 97 | -------------------------------------------------------------------------------- /images/develop/alpine/redis_cache.conf: -------------------------------------------------------------------------------- 1 | dbfilename redis_cache.rdb 2 | bind 0.0.0.0 3 | port 6379 4 | maxmemory 292mb 5 | maxmemory-policy allkeys-lru 6 | appendonly no 7 | 8 | save "" -------------------------------------------------------------------------------- /images/develop/alpine/test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM monogramm/docker-erpnext:develop-alpine 2 | 3 | COPY docker_test.sh /docker_test.sh 4 | 5 | RUN set -ex; \ 6 | sudo chmod 755 /docker_test.sh; 7 | 8 | CMD ["/docker_test.sh"] 9 | -------------------------------------------------------------------------------- /images/develop/debian-slim/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files during docker build 2 | 3 | # Docker-compose 4 | docker-compose.yml 5 | .env 6 | 7 | # DockerHub hooks 8 | hooks 9 | .dockertags 10 | 11 | # Custom configuration for tests 12 | redis_cache.conf 13 | nginx.conf 14 | -------------------------------------------------------------------------------- /images/develop/debian-slim/.dockertags: -------------------------------------------------------------------------------- 1 | develop-debian-slim 2 | -------------------------------------------------------------------------------- /images/develop/debian-slim/.env: -------------------------------------------------------------------------------- 1 | 2 | ######################################## 3 | # ERPNext configuration 4 | ######################################## 5 | 6 | ERPNEXT_SITE=localhost 7 | ERPNEXT_MAIL_HOST=mail 8 | 9 | ERPNEXT_ADMIN_PWD=erpnext_admin_password 10 | 11 | # Generated with openssl rand -base64 32 12 | ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic= 13 | 14 | ERPNEXT_DB_ROOT_LOGIN=root 15 | ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password 16 | 17 | # DB name will be used as the DB user 18 | ERPNEXT_DB_NAME=erpnext 19 | ERPNEXT_DB_PWD=erpnext_password 20 | 21 | ERPNEXT_SMTP_USER=erpnext 22 | ERPNEXT_SMTP_PWD=docker-erpnext 23 | 24 | -------------------------------------------------------------------------------- /images/develop/debian-slim/Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:develop-debian-slim 19 | 20 | ARG VERSION=develop 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext; \ 36 | sudo ./env/bin/pip3 install \ 37 | ldap3 \ 38 | ; 39 | 40 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 41 | 42 | ARG TAG 43 | ARG VCS_REF 44 | ARG BUILD_DATE 45 | 46 | # Build environment variables 47 | ENV DOCKER_TAG=${TAG} \ 48 | DOCKER_VCS_REF=${VCS_REF} \ 49 | DOCKER_BUILD_DATE=${BUILD_DATE} 50 | 51 | LABEL maintainer="Monogramm Maintainers " \ 52 | product="ERPNext" \ 53 | version=$VERSION \ 54 | org.label-schema.vcs-ref=$VCS_REF \ 55 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 56 | org.label-schema.build-date=$BUILD_DATE \ 57 | org.label-schema.name="ERPNext" \ 58 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 59 | org.label-schema.url="https://erpnext.com/" \ 60 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 61 | org.label-schema.version=$VERSION \ 62 | org.label-schema.schema-version="1.0" 63 | -------------------------------------------------------------------------------- /images/develop/debian-slim/hooks/README.md: -------------------------------------------------------------------------------- 1 | # DockerHub automated tests hooks 2 | 3 | See documentation for details: 4 | -------------------------------------------------------------------------------- /images/develop/debian-slim/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker build \ 7 | --build-arg "TAG=${DOCKER_TAG}" \ 8 | --build-arg "VCS_REF=$(git rev-parse --short HEAD)" \ 9 | --build-arg "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 10 | -f "$DOCKERFILE_PATH" \ 11 | -t "$IMAGE_NAME" . 12 | -------------------------------------------------------------------------------- /images/develop/debian-slim/hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_REGISTRY}" ]; then 7 | export DOCKER_BASE_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPO} 8 | else 9 | export DOCKER_BASE_IMAGE=${DOCKER_REPO} 10 | fi 11 | 12 | if [ -f ./.dockertags ]; then 13 | for tag in $(cat ./.dockertags); do 14 | if [ ! "${tag}" = "${DOCKER_TAG}" ]; then 15 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$tag" 16 | docker push "$DOCKER_BASE_IMAGE:$tag" 17 | fi 18 | done 19 | fi 20 | 21 | # Push image with tag set to commit hash 22 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 23 | docker push "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 24 | 25 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 26 | if [ -n "${DOCKER_REGISTRY}" ]; then 27 | echo "Logout of Docker Registry ${DOCKER_REGISTRY}..." 28 | docker logout "${DOCKER_REGISTRY}" 29 | else 30 | echo "Logout of Docker default Registry..." 31 | docker logout 32 | fi 33 | fi 34 | -------------------------------------------------------------------------------- /images/develop/debian-slim/hooks/post_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Removing persisted data...' 7 | #rm -rf '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | -------------------------------------------------------------------------------- /images/develop/debian-slim/hooks/pre_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 7 | if [ -n "${DOCKER_REGISTRY}" ]; then 8 | echo "Login to Docker Registry ${DOCKER_REGISTRY}..." 9 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}" 10 | else 11 | echo "Login to Docker default Registry..." 12 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /images/develop/debian-slim/hooks/pre_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Set permissions for persisted data...' 7 | #mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | #chown "1000:1000" '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 9 | #chmod 777 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 10 | -------------------------------------------------------------------------------- /images/develop/debian-slim/hooks/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker push "$IMAGE_NAME" 7 | -------------------------------------------------------------------------------- /images/develop/debian-slim/hooks/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Custom script to run locally DockerHub hooks 4 | # See documentation for details: 5 | # https://docs.docker.com/docker-hub/builds/advanced/ 6 | 7 | echo "Custom script to run locally DockerHub hooks..." 8 | set -e 9 | 10 | export SOURCE_BRANCH 11 | SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) 12 | export SOURCE_COMMIT 13 | SOURCE_COMMIT=$(git rev-parse --short HEAD) 14 | export COMMIT_MSG 15 | COMMIT_MSG=$(git log -1 --format=%s) 16 | 17 | export DOCKER_REPO=monogramm/docker-erpnext 18 | export DOCKERFILE_PATH=Dockerfile 19 | export DOCKER_TAG=develop 20 | 21 | if [ -n "${DOCKER_REGISTRY}" ]; then 22 | export IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG} 23 | else 24 | export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG} 25 | fi 26 | 27 | # Execute hooks in given order 28 | IFS=',' read -ra STEPS <<< "${1:-build,test}" 29 | for step in "${STEPS[@]}" 30 | do 31 | for hook in "pre_${step}" "${step}" "post_${step}"; do 32 | if [ -f "./hooks/${hook}" ]; then 33 | echo "Executing ${hook} hook..." 34 | "./hooks/${hook}" 35 | fi 36 | done 37 | done 38 | 39 | echo "DockerHub hooks finished" 40 | -------------------------------------------------------------------------------- /images/develop/debian-slim/hooks/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | for file in docker-compose*.test.yml; do 7 | 8 | echo "Starting Test in ${file}..." 9 | 10 | # Build test container 11 | docker-compose --no-ansi -f "${file}" build sut 12 | # Test container run 13 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 14 | docker-compose --no-ansi -f "${file}" logs -f "sut" 15 | docker-compose --no-ansi -f "${file}" ps 16 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 17 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 18 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 19 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 20 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 21 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 22 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 23 | docker-compose --no-ansi -f "${file}" down 24 | # Test container restart 25 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 26 | docker-compose --no-ansi -f "${file}" logs -f "sut" 27 | docker-compose --no-ansi -f "${file}" ps 28 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 29 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 30 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 31 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 32 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 33 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 34 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 35 | docker-compose --no-ansi -f "${file}" down --volumes 36 | 37 | done 38 | -------------------------------------------------------------------------------- /images/develop/debian-slim/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | upstream bench-frappe { 3 | # Call App container from Docker network 4 | server erpnext_app:8000 fail_timeout=0; 5 | } 6 | 7 | upstream bench-socketio-server { 8 | # Call Socketio container from Docker network 9 | server erpnext_socketio:3000 fail_timeout=0; 10 | } 11 | 12 | server { 13 | listen 80; 14 | 15 | server_name localhost; 16 | 17 | root /home/frappe/frappe-bench/sites; 18 | 19 | location /assets { 20 | try_files $uri =404; 21 | } 22 | 23 | location ~ ^/protected/(.*) { 24 | internal; 25 | try_files /$host/$1 =404; 26 | } 27 | 28 | location /socket.io { 29 | proxy_http_version 1.1; 30 | proxy_set_header Upgrade $http_upgrade; 31 | proxy_set_header Connection "upgrade"; 32 | proxy_set_header X-Frappe-Site-Name $host; 33 | proxy_set_header Origin $scheme://$http_host; 34 | proxy_set_header Host $host; 35 | 36 | proxy_pass http://bench-socketio-server; 37 | } 38 | 39 | location / { 40 | try_files /$host/public/$uri @webserver; 41 | } 42 | 43 | location @webserver { 44 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 | proxy_set_header X-Forwarded-Proto $scheme; 46 | proxy_set_header X-Frappe-Site-Name $host; 47 | proxy_set_header Host $host; 48 | proxy_set_header X-Use-X-Accel-Redirect True; 49 | proxy_read_timeout 600; 50 | proxy_redirect off; 51 | 52 | proxy_pass http://bench-frappe; 53 | } 54 | 55 | # error pages 56 | error_page 502 /502.html; 57 | location /502.html { 58 | root /home/frappe/bench-repo/bench/config/templates; 59 | internal; 60 | } 61 | 62 | # optimizations 63 | sendfile on; 64 | keepalive_timeout 15; 65 | client_max_body_size 50m; 66 | client_body_buffer_size 16K; 67 | client_header_buffer_size 1k; 68 | 69 | # enable gzip compresion 70 | # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge 71 | gzip on; 72 | gzip_http_version 1.1; 73 | gzip_comp_level 5; 74 | gzip_min_length 256; 75 | gzip_proxied any; 76 | gzip_vary on; 77 | gzip_types 78 | application/atom+xml 79 | application/javascript 80 | application/json 81 | application/rss+xml 82 | application/vnd.ms-fontobject 83 | application/x-font-ttf 84 | application/font-woff 85 | application/x-web-app-manifest+json 86 | application/xhtml+xml 87 | application/xml 88 | font/opentype 89 | image/svg+xml 90 | image/x-icon 91 | text/css 92 | text/plain 93 | text/x-component 94 | ; 95 | # text/html is always compressed by HttpGzipModule 96 | } 97 | -------------------------------------------------------------------------------- /images/develop/debian-slim/redis_cache.conf: -------------------------------------------------------------------------------- 1 | dbfilename redis_cache.rdb 2 | bind 0.0.0.0 3 | port 6379 4 | maxmemory 292mb 5 | maxmemory-policy allkeys-lru 6 | appendonly no 7 | 8 | save "" -------------------------------------------------------------------------------- /images/develop/debian-slim/test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM monogramm/docker-erpnext:develop-alpine 2 | 3 | COPY docker_test.sh /docker_test.sh 4 | 5 | RUN set -ex; \ 6 | sudo chmod 755 /docker_test.sh; 7 | 8 | CMD ["/docker_test.sh"] 9 | -------------------------------------------------------------------------------- /images/develop/debian/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files during docker build 2 | 3 | # Docker-compose 4 | docker-compose.yml 5 | .env 6 | 7 | # DockerHub hooks 8 | hooks 9 | .dockertags 10 | 11 | # Custom configuration for tests 12 | redis_cache.conf 13 | nginx.conf 14 | -------------------------------------------------------------------------------- /images/develop/debian/.dockertags: -------------------------------------------------------------------------------- 1 | develop-debian 2 | -------------------------------------------------------------------------------- /images/develop/debian/.env: -------------------------------------------------------------------------------- 1 | 2 | ######################################## 3 | # ERPNext configuration 4 | ######################################## 5 | 6 | ERPNEXT_SITE=localhost 7 | ERPNEXT_MAIL_HOST=mail 8 | 9 | ERPNEXT_ADMIN_PWD=erpnext_admin_password 10 | 11 | # Generated with openssl rand -base64 32 12 | ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic= 13 | 14 | ERPNEXT_DB_ROOT_LOGIN=root 15 | ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password 16 | 17 | # DB name will be used as the DB user 18 | ERPNEXT_DB_NAME=erpnext 19 | ERPNEXT_DB_PWD=erpnext_password 20 | 21 | ERPNEXT_SMTP_USER=erpnext 22 | ERPNEXT_SMTP_PWD=docker-erpnext 23 | 24 | -------------------------------------------------------------------------------- /images/develop/debian/Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:develop-debian 19 | 20 | ARG VERSION=develop 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext; \ 36 | sudo ./env/bin/pip3 install \ 37 | ldap3 \ 38 | ; 39 | 40 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 41 | 42 | ARG TAG 43 | ARG VCS_REF 44 | ARG BUILD_DATE 45 | 46 | # Build environment variables 47 | ENV DOCKER_TAG=${TAG} \ 48 | DOCKER_VCS_REF=${VCS_REF} \ 49 | DOCKER_BUILD_DATE=${BUILD_DATE} 50 | 51 | LABEL maintainer="Monogramm Maintainers " \ 52 | product="ERPNext" \ 53 | version=$VERSION \ 54 | org.label-schema.vcs-ref=$VCS_REF \ 55 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 56 | org.label-schema.build-date=$BUILD_DATE \ 57 | org.label-schema.name="ERPNext" \ 58 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 59 | org.label-schema.url="https://erpnext.com/" \ 60 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 61 | org.label-schema.version=$VERSION \ 62 | org.label-schema.schema-version="1.0" 63 | -------------------------------------------------------------------------------- /images/develop/debian/hooks/README.md: -------------------------------------------------------------------------------- 1 | # DockerHub automated tests hooks 2 | 3 | See documentation for details: 4 | -------------------------------------------------------------------------------- /images/develop/debian/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker build \ 7 | --build-arg "TAG=${DOCKER_TAG}" \ 8 | --build-arg "VCS_REF=$(git rev-parse --short HEAD)" \ 9 | --build-arg "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 10 | -f "$DOCKERFILE_PATH" \ 11 | -t "$IMAGE_NAME" . 12 | -------------------------------------------------------------------------------- /images/develop/debian/hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_REGISTRY}" ]; then 7 | export DOCKER_BASE_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPO} 8 | else 9 | export DOCKER_BASE_IMAGE=${DOCKER_REPO} 10 | fi 11 | 12 | if [ -f ./.dockertags ]; then 13 | for tag in $(cat ./.dockertags); do 14 | if [ ! "${tag}" = "${DOCKER_TAG}" ]; then 15 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$tag" 16 | docker push "$DOCKER_BASE_IMAGE:$tag" 17 | fi 18 | done 19 | fi 20 | 21 | # Push image with tag set to commit hash 22 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 23 | docker push "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 24 | 25 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 26 | if [ -n "${DOCKER_REGISTRY}" ]; then 27 | echo "Logout of Docker Registry ${DOCKER_REGISTRY}..." 28 | docker logout "${DOCKER_REGISTRY}" 29 | else 30 | echo "Logout of Docker default Registry..." 31 | docker logout 32 | fi 33 | fi 34 | -------------------------------------------------------------------------------- /images/develop/debian/hooks/post_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Removing persisted data...' 7 | #rm -rf '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | -------------------------------------------------------------------------------- /images/develop/debian/hooks/pre_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 7 | if [ -n "${DOCKER_REGISTRY}" ]; then 8 | echo "Login to Docker Registry ${DOCKER_REGISTRY}..." 9 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}" 10 | else 11 | echo "Login to Docker default Registry..." 12 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /images/develop/debian/hooks/pre_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Set permissions for persisted data...' 7 | #mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | #chown "1000:1000" '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 9 | #chmod 777 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 10 | -------------------------------------------------------------------------------- /images/develop/debian/hooks/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker push "$IMAGE_NAME" 7 | -------------------------------------------------------------------------------- /images/develop/debian/hooks/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Custom script to run locally DockerHub hooks 4 | # See documentation for details: 5 | # https://docs.docker.com/docker-hub/builds/advanced/ 6 | 7 | echo "Custom script to run locally DockerHub hooks..." 8 | set -e 9 | 10 | export SOURCE_BRANCH 11 | SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) 12 | export SOURCE_COMMIT 13 | SOURCE_COMMIT=$(git rev-parse --short HEAD) 14 | export COMMIT_MSG 15 | COMMIT_MSG=$(git log -1 --format=%s) 16 | 17 | export DOCKER_REPO=monogramm/docker-erpnext 18 | export DOCKERFILE_PATH=Dockerfile 19 | export DOCKER_TAG=develop 20 | 21 | if [ -n "${DOCKER_REGISTRY}" ]; then 22 | export IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG} 23 | else 24 | export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG} 25 | fi 26 | 27 | # Execute hooks in given order 28 | IFS=',' read -ra STEPS <<< "${1:-build,test}" 29 | for step in "${STEPS[@]}" 30 | do 31 | for hook in "pre_${step}" "${step}" "post_${step}"; do 32 | if [ -f "./hooks/${hook}" ]; then 33 | echo "Executing ${hook} hook..." 34 | "./hooks/${hook}" 35 | fi 36 | done 37 | done 38 | 39 | echo "DockerHub hooks finished" 40 | -------------------------------------------------------------------------------- /images/develop/debian/hooks/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | for file in docker-compose*.test.yml; do 7 | 8 | echo "Starting Test in ${file}..." 9 | 10 | # Build test container 11 | docker-compose --no-ansi -f "${file}" build sut 12 | # Test container run 13 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 14 | docker-compose --no-ansi -f "${file}" logs -f "sut" 15 | docker-compose --no-ansi -f "${file}" ps 16 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 17 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 18 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 19 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 20 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 21 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 22 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 23 | docker-compose --no-ansi -f "${file}" down 24 | # Test container restart 25 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 26 | docker-compose --no-ansi -f "${file}" logs -f "sut" 27 | docker-compose --no-ansi -f "${file}" ps 28 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 29 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 30 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 31 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 32 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 33 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 34 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 35 | docker-compose --no-ansi -f "${file}" down --volumes 36 | 37 | done 38 | -------------------------------------------------------------------------------- /images/develop/debian/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | upstream bench-frappe { 3 | # Call App container from Docker network 4 | server erpnext_app:8000 fail_timeout=0; 5 | } 6 | 7 | upstream bench-socketio-server { 8 | # Call Socketio container from Docker network 9 | server erpnext_socketio:3000 fail_timeout=0; 10 | } 11 | 12 | server { 13 | listen 80; 14 | 15 | server_name localhost; 16 | 17 | root /home/frappe/frappe-bench/sites; 18 | 19 | location /assets { 20 | try_files $uri =404; 21 | } 22 | 23 | location ~ ^/protected/(.*) { 24 | internal; 25 | try_files /$host/$1 =404; 26 | } 27 | 28 | location /socket.io { 29 | proxy_http_version 1.1; 30 | proxy_set_header Upgrade $http_upgrade; 31 | proxy_set_header Connection "upgrade"; 32 | proxy_set_header X-Frappe-Site-Name $host; 33 | proxy_set_header Origin $scheme://$http_host; 34 | proxy_set_header Host $host; 35 | 36 | proxy_pass http://bench-socketio-server; 37 | } 38 | 39 | location / { 40 | try_files /$host/public/$uri @webserver; 41 | } 42 | 43 | location @webserver { 44 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 | proxy_set_header X-Forwarded-Proto $scheme; 46 | proxy_set_header X-Frappe-Site-Name $host; 47 | proxy_set_header Host $host; 48 | proxy_set_header X-Use-X-Accel-Redirect True; 49 | proxy_read_timeout 600; 50 | proxy_redirect off; 51 | 52 | proxy_pass http://bench-frappe; 53 | } 54 | 55 | # error pages 56 | error_page 502 /502.html; 57 | location /502.html { 58 | root /home/frappe/bench-repo/bench/config/templates; 59 | internal; 60 | } 61 | 62 | # optimizations 63 | sendfile on; 64 | keepalive_timeout 15; 65 | client_max_body_size 50m; 66 | client_body_buffer_size 16K; 67 | client_header_buffer_size 1k; 68 | 69 | # enable gzip compresion 70 | # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge 71 | gzip on; 72 | gzip_http_version 1.1; 73 | gzip_comp_level 5; 74 | gzip_min_length 256; 75 | gzip_proxied any; 76 | gzip_vary on; 77 | gzip_types 78 | application/atom+xml 79 | application/javascript 80 | application/json 81 | application/rss+xml 82 | application/vnd.ms-fontobject 83 | application/x-font-ttf 84 | application/font-woff 85 | application/x-web-app-manifest+json 86 | application/xhtml+xml 87 | application/xml 88 | font/opentype 89 | image/svg+xml 90 | image/x-icon 91 | text/css 92 | text/plain 93 | text/x-component 94 | ; 95 | # text/html is always compressed by HttpGzipModule 96 | } 97 | -------------------------------------------------------------------------------- /images/develop/debian/redis_cache.conf: -------------------------------------------------------------------------------- 1 | dbfilename redis_cache.rdb 2 | bind 0.0.0.0 3 | port 6379 4 | maxmemory 292mb 5 | maxmemory-policy allkeys-lru 6 | appendonly no 7 | 8 | save "" -------------------------------------------------------------------------------- /images/develop/debian/test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM monogramm/docker-erpnext:develop-alpine 2 | 3 | COPY docker_test.sh /docker_test.sh 4 | 5 | RUN set -ex; \ 6 | sudo chmod 755 /docker_test.sh; 7 | 8 | CMD ["/docker_test.sh"] 9 | -------------------------------------------------------------------------------- /template/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore files during docker build 2 | 3 | # Docker-compose 4 | docker-compose.yml 5 | .env 6 | 7 | # DockerHub hooks 8 | hooks 9 | .dockertags 10 | 11 | # Custom configuration for tests 12 | redis_cache.conf 13 | nginx.conf 14 | -------------------------------------------------------------------------------- /template/.env: -------------------------------------------------------------------------------- 1 | 2 | ######################################## 3 | # ERPNext configuration 4 | ######################################## 5 | 6 | ERPNEXT_SITE={{ NGINX_SERVER_NAME }} 7 | ERPNEXT_MAIL_HOST=mail 8 | 9 | ERPNEXT_ADMIN_PWD=erpnext_admin_password 10 | 11 | # Generated with openssl rand -base64 32 12 | ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic= 13 | 14 | ERPNEXT_DB_ROOT_LOGIN=root 15 | ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password 16 | 17 | # DB name will be used as the DB user 18 | ERPNEXT_DB_NAME=erpnext 19 | ERPNEXT_DB_PWD=erpnext_password 20 | 21 | ERPNEXT_SMTP_USER=erpnext 22 | ERPNEXT_SMTP_PWD=docker-erpnext 23 | 24 | -------------------------------------------------------------------------------- /template/Dockerfile.alpine.template: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:%%FRAPPE_VERSION%%-%%VARIANT%% 19 | 20 | ARG VERSION=%%VERSION%% 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | sudo apk add python3-dev py3-setuptools; \ 36 | export PATH=/home/$FRAPPE_USER/.local/bin:$PATH; \ 37 | pip%%PIP_VERSION%% install Cython==0.29.10; \ 38 | pip%%PIP_VERSION%% install numpy==1.17.4; \ 39 | pip%%PIP_VERSION%% install pandas==0.24.2; \ 40 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext 41 | 42 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 43 | 44 | ARG TAG 45 | ARG VCS_REF 46 | ARG BUILD_DATE 47 | 48 | # Build environment variables 49 | ENV DOCKER_TAG=${TAG} \ 50 | DOCKER_VCS_REF=${VCS_REF} \ 51 | DOCKER_BUILD_DATE=${BUILD_DATE} 52 | 53 | LABEL maintainer="Monogramm Maintainers " \ 54 | product="ERPNext" \ 55 | version=$VERSION \ 56 | org.label-schema.vcs-ref=$VCS_REF \ 57 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 58 | org.label-schema.build-date=$BUILD_DATE \ 59 | org.label-schema.name="ERPNext" \ 60 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 61 | org.label-schema.url="https://erpnext.com/" \ 62 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 63 | org.label-schema.version=$VERSION \ 64 | org.label-schema.schema-version="1.0" 65 | -------------------------------------------------------------------------------- /template/Dockerfile.debian.template: -------------------------------------------------------------------------------- 1 | ## 2 | ## Docker image for ERPNext. 3 | ## Copyright (C) 2020 Monogramm 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU Affero General Public License as published 7 | ## by the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU Affero General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Affero General Public License 16 | ## along with this program. If not, see . 17 | ## 18 | FROM monogramm/docker-frappe:%%FRAPPE_VERSION%%-%%VARIANT%% 19 | 20 | ARG VERSION=%%VERSION%% 21 | 22 | # Build environment variables 23 | ENV ERPNEXT_BRANCH=${VERSION} \ 24 | FRAPPE_APP_PROTECTED='frappe erpnext' \ 25 | DOCKER_GUNICORN_TIMEOUT=600 26 | 27 | # Setup ERPNext 28 | RUN set -ex; \ 29 | sudo mkdir -p "/home/$FRAPPE_USER"/frappe-bench/logs; \ 30 | sudo touch "/home/$FRAPPE_USER"/frappe-bench/logs/bench.log; \ 31 | sudo chmod 777 \ 32 | "/home/$FRAPPE_USER"/frappe-bench/logs \ 33 | "/home/$FRAPPE_USER"/frappe-bench/logs/* \ 34 | ; \ 35 | bench get-app --branch "$ERPNEXT_BRANCH" erpnext https://github.com/frappe/erpnext; \ 36 | sudo ./env/bin/pip%%PIP_VERSION%% install \ 37 | ldap3 \ 38 | ; 39 | 40 | VOLUME /home/$FRAPPE_USER/frappe-bench/apps/erpnext/erpnext/public 41 | 42 | ARG TAG 43 | ARG VCS_REF 44 | ARG BUILD_DATE 45 | 46 | # Build environment variables 47 | ENV DOCKER_TAG=${TAG} \ 48 | DOCKER_VCS_REF=${VCS_REF} \ 49 | DOCKER_BUILD_DATE=${BUILD_DATE} 50 | 51 | LABEL maintainer="Monogramm Maintainers " \ 52 | product="ERPNext" \ 53 | version=$VERSION \ 54 | org.label-schema.vcs-ref=$VCS_REF \ 55 | org.label-schema.vcs-url="https://github.com/Monogramm/docker-erpnext" \ 56 | org.label-schema.build-date=$BUILD_DATE \ 57 | org.label-schema.name="ERPNext" \ 58 | org.label-schema.description="Open Source ERP built for the web, supports manufacturing, distribution, retail, trading, services, education, non profits and healthcare." \ 59 | org.label-schema.url="https://erpnext.com/" \ 60 | org.label-schema.vendor="Frappé Technologies Pvt. Ltd" \ 61 | org.label-schema.version=$VERSION \ 62 | org.label-schema.schema-version="1.0" 63 | -------------------------------------------------------------------------------- /template/hooks/README.md: -------------------------------------------------------------------------------- 1 | # DockerHub automated tests hooks 2 | 3 | See documentation for details: 4 | -------------------------------------------------------------------------------- /template/hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker build \ 7 | --build-arg "TAG=${DOCKER_TAG}" \ 8 | --build-arg "VCS_REF=$(git rev-parse --short HEAD)" \ 9 | --build-arg "BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ 10 | -f "$DOCKERFILE_PATH" \ 11 | -t "$IMAGE_NAME" . 12 | -------------------------------------------------------------------------------- /template/hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_REGISTRY}" ]; then 7 | export DOCKER_BASE_IMAGE=${DOCKER_REGISTRY}/${DOCKER_REPO} 8 | else 9 | export DOCKER_BASE_IMAGE=${DOCKER_REPO} 10 | fi 11 | 12 | if [ -f ./.dockertags ]; then 13 | for tag in $(cat ./.dockertags); do 14 | if [ ! "${tag}" = "${DOCKER_TAG}" ]; then 15 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$tag" 16 | docker push "$DOCKER_BASE_IMAGE:$tag" 17 | fi 18 | done 19 | fi 20 | 21 | # Push image with tag set to commit hash 22 | docker tag "$IMAGE_NAME" "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 23 | docker push "$DOCKER_BASE_IMAGE:$SOURCE_COMMIT" 24 | 25 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 26 | if [ -n "${DOCKER_REGISTRY}" ]; then 27 | echo "Logout of Docker Registry ${DOCKER_REGISTRY}..." 28 | docker logout "${DOCKER_REGISTRY}" 29 | else 30 | echo "Logout of Docker default Registry..." 31 | docker logout 32 | fi 33 | fi 34 | -------------------------------------------------------------------------------- /template/hooks/post_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Removing persisted data...' 7 | #rm -rf '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | -------------------------------------------------------------------------------- /template/hooks/pre_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_LOGIN}" ]; then 7 | if [ -n "${DOCKER_REGISTRY}" ]; then 8 | echo "Login to Docker Registry ${DOCKER_REGISTRY}..." 9 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}" 10 | else 11 | echo "Login to Docker default Registry..." 12 | docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /template/hooks/pre_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | #echo 'Set permissions for persisted data...' 7 | #mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 8 | #chown "1000:1000" '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 9 | #chmod 777 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs' 10 | -------------------------------------------------------------------------------- /template/hooks/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | docker push "$IMAGE_NAME" 7 | -------------------------------------------------------------------------------- /template/hooks/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Custom script to run locally DockerHub hooks 4 | # See documentation for details: 5 | # https://docs.docker.com/docker-hub/builds/advanced/ 6 | 7 | echo "Custom script to run locally DockerHub hooks..." 8 | set -e 9 | 10 | export SOURCE_BRANCH 11 | SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD) 12 | export SOURCE_COMMIT 13 | SOURCE_COMMIT=$(git rev-parse --short HEAD) 14 | export COMMIT_MSG 15 | COMMIT_MSG=$(git log -1 --format=%s) 16 | 17 | export DOCKER_REPO= 18 | export DOCKERFILE_PATH=Dockerfile 19 | export DOCKER_TAG= 20 | 21 | if [ -n "${DOCKER_REGISTRY}" ]; then 22 | export IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG} 23 | else 24 | export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG} 25 | fi 26 | 27 | # Execute hooks in given order 28 | IFS=',' read -ra STEPS <<< "${1:-build,test}" 29 | for step in "${STEPS[@]}" 30 | do 31 | for hook in "pre_${step}" "${step}" "post_${step}"; do 32 | if [ -f "./hooks/${hook}" ]; then 33 | echo "Executing ${hook} hook..." 34 | "./hooks/${hook}" 35 | fi 36 | done 37 | done 38 | 39 | echo "DockerHub hooks finished" 40 | -------------------------------------------------------------------------------- /template/hooks/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # See documentation for details: 4 | # https://docs.docker.com/docker-hub/builds/advanced/ 5 | 6 | for file in docker-compose*.test.yml; do 7 | 8 | echo "Starting Test in ${file}..." 9 | 10 | # Build test container 11 | docker-compose --no-ansi -f "${file}" build sut 12 | # Test container run 13 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 14 | docker-compose --no-ansi -f "${file}" logs -f "sut" 15 | docker-compose --no-ansi -f "${file}" ps 16 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 17 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 18 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 19 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 20 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 21 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 22 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 23 | docker-compose --no-ansi -f "${file}" down 24 | # Test container restart 25 | docker-compose --no-ansi -f "${file}" up -d && sleep 60 26 | docker-compose --no-ansi -f "${file}" logs -f "sut" 27 | docker-compose --no-ansi -f "${file}" ps 28 | docker-compose --no-ansi -f "${file}" logs "erpnext_db" 29 | docker-compose --no-ansi -f "${file}" ps "erpnext_db" | grep "Up" 30 | docker-compose --no-ansi -f "${file}" logs "erpnext_app" 31 | docker-compose --no-ansi -f "${file}" ps "erpnext_app" | grep "Up" 32 | docker-compose --no-ansi -f "${file}" logs "erpnext_web" 33 | docker-compose --no-ansi -f "${file}" ps "erpnext_web" | grep "Up" 34 | #docker-compose --no-ansi -f "${file}" ps "sut" | grep "Exit 0" || exit 1 35 | docker-compose --no-ansi -f "${file}" down --volumes 36 | 37 | done 38 | -------------------------------------------------------------------------------- /template/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | upstream bench-frappe { 3 | # Call App container from Docker network 4 | server erpnext_app:8000 fail_timeout=0; 5 | } 6 | 7 | upstream bench-socketio-server { 8 | # Call Socketio container from Docker network 9 | server erpnext_socketio:3000 fail_timeout=0; 10 | } 11 | 12 | server { 13 | listen 80; 14 | 15 | server_name {{ NGINX_SERVER_NAME }}; 16 | 17 | root /home/frappe/frappe-bench/sites; 18 | 19 | location /assets { 20 | try_files $uri =404; 21 | } 22 | 23 | location ~ ^/protected/(.*) { 24 | internal; 25 | try_files /$host/$1 =404; 26 | } 27 | 28 | location /socket.io { 29 | proxy_http_version 1.1; 30 | proxy_set_header Upgrade $http_upgrade; 31 | proxy_set_header Connection "upgrade"; 32 | proxy_set_header X-Frappe-Site-Name $host; 33 | proxy_set_header Origin $scheme://$http_host; 34 | proxy_set_header Host $host; 35 | 36 | proxy_pass http://bench-socketio-server; 37 | } 38 | 39 | location / { 40 | try_files /$host/public/$uri @webserver; 41 | } 42 | 43 | location @webserver { 44 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 | proxy_set_header X-Forwarded-Proto $scheme; 46 | proxy_set_header X-Frappe-Site-Name $host; 47 | proxy_set_header Host $host; 48 | proxy_set_header X-Use-X-Accel-Redirect True; 49 | proxy_read_timeout 600; 50 | proxy_redirect off; 51 | 52 | proxy_pass http://bench-frappe; 53 | } 54 | 55 | # error pages 56 | error_page 502 /502.html; 57 | location /502.html { 58 | root /home/frappe/bench-repo/bench/config/templates; 59 | internal; 60 | } 61 | 62 | # optimizations 63 | sendfile on; 64 | keepalive_timeout 15; 65 | client_max_body_size 50m; 66 | client_body_buffer_size 16K; 67 | client_header_buffer_size 1k; 68 | 69 | # enable gzip compresion 70 | # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge 71 | gzip on; 72 | gzip_http_version 1.1; 73 | gzip_comp_level 5; 74 | gzip_min_length 256; 75 | gzip_proxied any; 76 | gzip_vary on; 77 | gzip_types 78 | application/atom+xml 79 | application/javascript 80 | application/json 81 | application/rss+xml 82 | application/vnd.ms-fontobject 83 | application/x-font-ttf 84 | application/font-woff 85 | application/x-web-app-manifest+json 86 | application/xhtml+xml 87 | application/xml 88 | font/opentype 89 | image/svg+xml 90 | image/x-icon 91 | text/css 92 | text/plain 93 | text/x-component 94 | ; 95 | # text/html is always compressed by HttpGzipModule 96 | } 97 | -------------------------------------------------------------------------------- /template/redis_cache.conf: -------------------------------------------------------------------------------- 1 | dbfilename redis_cache.rdb 2 | bind 0.0.0.0 3 | port 6379 4 | maxmemory 292mb 5 | maxmemory-policy allkeys-lru 6 | appendonly no 7 | 8 | save "" -------------------------------------------------------------------------------- /template/test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM monogramm/docker-erpnext:%%ERPNEXT_VERSION%%-alpine 2 | 3 | COPY docker_test.sh /docker_test.sh 4 | 5 | RUN set -ex; \ 6 | sudo chmod 755 /docker_test.sh; 7 | 8 | CMD ["/docker_test.sh"] 9 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | declare -A base=( 5 | [debian]='debian' 6 | [debian-slim]='debian' 7 | [alpine]='alpine' 8 | ) 9 | 10 | variants=( 11 | debian 12 | debian-slim 13 | alpine 14 | ) 15 | 16 | 17 | # version_greater_or_equal A B returns whether A >= B 18 | function version_greater_or_equal() { 19 | [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" || "$1" == "$2" ]]; 20 | } 21 | 22 | min_version=11 23 | dockerLatest='13.5' 24 | dockerDefaultVariant='alpine' 25 | 26 | dockerRepo="monogramm/docker-erpnext" 27 | latests=( 28 | $( curl -fsSL 'https://api.github.com/repos/frappe/erpnext/tags' |tac|tac| \ 29 | grep -oE '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' | \ 30 | sort -urV ) 31 | version-11-hotfix 32 | develop 33 | ) 34 | 35 | # Remove existing images 36 | echo "reset docker images" 37 | rm -rf ./images/ 38 | mkdir ./images/ 39 | 40 | echo "update docker images" 41 | readmeTags= 42 | githubEnv= 43 | travisEnv= 44 | for latest in "${latests[@]}"; do 45 | version=$(echo "$latest" | cut -d. -f1-2) 46 | major=$(echo "$latest" | cut -d. -f1-1) 47 | if [ "$latest" = "version-11-hotfix" ]; then 48 | version=11.x 49 | major=11 50 | fi 51 | 52 | # Only add versions >= "$min_version" 53 | if version_greater_or_equal "$version" "$min_version"; then 54 | 55 | if [ ! -d "images/$major" ]; then 56 | # Add GitHub Actions env var 57 | githubEnv="'$major', $githubEnv" 58 | fi 59 | 60 | for variant in "${variants[@]}"; do 61 | # Create the version+variant directory with a Dockerfile. 62 | dir="images/$major/$variant" 63 | if [ -d "$dir" ]; then 64 | continue 65 | fi 66 | echo "generating frappe $latest [$major] ($variant)" 67 | mkdir -p "$dir" 68 | 69 | # Copy the docker files 70 | for name in redis_cache.conf nginx.conf .env; do 71 | cp "template/$name" "$dir/$name" 72 | sed -i \ 73 | -e 's/{{ NGINX_SERVER_NAME }}/localhost/g' \ 74 | "$dir/$name" 75 | done 76 | 77 | cp "template/docker-compose_mariadb.yml" "$dir/docker-compose.mariadb.yml" 78 | case $latest in 79 | 10.*|11.*) echo "Postgres not supported for $latest";; 80 | *) cp "template/docker-compose_postgres.yml" "$dir/docker-compose.postgres.yml";; 81 | esac 82 | 83 | template="template/Dockerfile.${base[$variant]}.template" 84 | cp "$template" "$dir/Dockerfile" 85 | 86 | cp "template/.dockerignore" "$dir/.dockerignore" 87 | cp -r "./template/hooks" "$dir/hooks" 88 | cp -r "./template/test" "$dir/" 89 | cp -r "template/docker-compose.test.yml" "$dir/docker-compose.test.yml" 90 | 91 | # Replace the variables. 92 | if [ "$latest" = "develop" ] || [ "$latest" = "version-11-hotfix" ]; then 93 | sed -ri -e ' 94 | s/%%VARIANT%%/'"$variant"'/g; 95 | s/%%VERSION%%/'"$latest"'/g; 96 | s/%%PIP_VERSION%%/3/g; 97 | s/%%FRAPPE_VERSION%%/'"$major"'/g; 98 | s/%%ERPNEXT_VERSION%%/'"$major"'/g; 99 | ' "$dir/Dockerfile" "$dir/test/Dockerfile" "$dir/docker-compose."*.yml 100 | elif [ "$latest" = "10.x.x" ]; then 101 | # FIXME https://github.com/frappe/frappe/issues/7737 102 | sed -ri -e ' 103 | s/%%VARIANT%%/'"$variant"'/g; 104 | s/%%VERSION%%/'"v$latest"'/g; 105 | s/%%PIP_VERSION%%//g; 106 | s/%%FRAPPE_VERSION%%/10/g; 107 | s/%%ERPNEXT_VERSION%%/10/g; 108 | ' "$dir/Dockerfile" "$dir/test/Dockerfile" "$dir/docker-compose."*.yml 109 | else 110 | sed -ri -e ' 111 | s/%%VARIANT%%/'"$variant"'/g; 112 | s/%%VERSION%%/'"v$latest"'/g; 113 | s/%%PIP_VERSION%%/3/g; 114 | s/%%FRAPPE_VERSION%%/'"$major"'/g; 115 | s/%%ERPNEXT_VERSION%%/'"$major"'/g; 116 | ' "$dir/Dockerfile" "$dir/test/Dockerfile" "$dir/docker-compose."*.yml 117 | fi 118 | 119 | sed -ri -e ' 120 | s|DOCKER_TAG=.*|DOCKER_TAG='"$version"'|g; 121 | s|DOCKER_REPO=.*|DOCKER_REPO='"$dockerRepo"'|g; 122 | ' "$dir/hooks/run" 123 | 124 | # Create a list of "alias" tags for DockerHub post_push 125 | if [ "$version" = "$dockerLatest" ]; then 126 | if [ "$variant" = "$dockerDefaultVariant" ]; then 127 | export DOCKER_TAGS="$latest-$variant $version-$variant $major-$variant $variant $latest $version $major latest " 128 | else 129 | export DOCKER_TAGS="$latest-$variant $version-$variant $major-$variant $variant " 130 | fi 131 | elif [ "$version" = "$latest" ]; then 132 | if [ "$variant" = "$dockerDefaultVariant" ]; then 133 | export DOCKER_TAGS="$latest-$variant $latest " 134 | else 135 | export DOCKER_TAGS="$latest-$variant " 136 | fi 137 | else 138 | if [ "$variant" = "$dockerDefaultVariant" ]; then 139 | export DOCKER_TAGS="$latest-$variant $version-$variant $major-$variant $latest $version $major " 140 | else 141 | export DOCKER_TAGS="$latest-$variant $version-$variant $major-$variant " 142 | fi 143 | fi 144 | echo "${DOCKER_TAGS} " > "$dir/.dockertags" 145 | 146 | # Add README tags 147 | readmeTags="$readmeTags\n- ${DOCKER_TAGS} (\`$dir/Dockerfile\`)" 148 | 149 | # Add Travis-CI env var 150 | travisEnv='\n - VERSION='"$major"' VARIANT='"$variant"' DATABASE=mariadb'"$travisEnv" 151 | case $latest in 152 | 10.*|11.*) echo "Postgres not supported for $latest";; 153 | *) travisEnv='\n - VERSION='"$major"' VARIANT='"$variant"' DATABASE=postgres'"$travisEnv";; 154 | esac 155 | 156 | if [[ $1 == 'build' ]]; then 157 | tag="$major-$variant" 158 | echo "Build Dockerfile for ${tag}" 159 | docker build -t "${dockerRepo}:${tag}" "$dir" 160 | fi 161 | done 162 | 163 | fi 164 | 165 | done 166 | 167 | # update README.md 168 | sed '/^/,/^/{/^/!{/^/!d}}' README.md > README.md.tmp 169 | sed -e "s||\n$readmeTags\n|g" README.md.tmp > README.md 170 | rm README.md.tmp 171 | 172 | # update .github workflows 173 | sed -i -e "s|version: \[.*\]|version: [${githubEnv}]|g" .github/workflows/hooks.yml 174 | 175 | # update .travis.yml 176 | travis="$(awk -v 'RS=\n\n' '$1 == "env:" && $2 == "#" && $3 == "Environments" { $0 = "env: # Environments'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)" 177 | echo "$travis" > .travis.yml 178 | --------------------------------------------------------------------------------