diff --git a/.github/workflows/app-build-image.yml b/.github/workflows/app-build-image.yml index df63d19..a33c1c8 100644 --- a/.github/workflows/app-build-image.yml +++ b/.github/workflows/app-build-image.yml @@ -86,7 +86,7 @@ jobs: steps: - name: Checkout builder repository - uses: actions/checkout@v6 + uses: actions/checkout@v7 with: repository: ${{ inputs.builder_repository }} ref: ${{ inputs.builder_ref }} diff --git a/.github/workflows/core-build-bench.yml b/.github/workflows/core-build-bench.yml index ef0ecbd..ba348cb 100644 --- a/.github/workflows/core-build-bench.yml +++ b/.github/workflows/core-build-bench.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Setup QEMU uses: docker/setup-qemu-action@v4 @@ -38,7 +38,7 @@ jobs: run: echo "LATEST_BENCH_RELEASE=$(curl -s 'https://api.github.com/repos/frappe/bench/releases/latest' | jq -r '.tag_name')" >> "$GITHUB_ENV" - name: Build and test - uses: docker/bake-action@v7.1.0 + uses: docker/bake-action@v7.3.0 with: source: . targets: bench-test @@ -52,7 +52,7 @@ jobs: - name: Push if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} - uses: docker/bake-action@v7.1.0 + uses: docker/bake-action@v7.3.0 with: targets: bench push: true diff --git a/.github/workflows/core-build-stable.yml b/.github/workflows/core-build-stable.yml index e5fe663..6aa14fe 100644 --- a/.github/workflows/core-build-stable.yml +++ b/.github/workflows/core-build-stable.yml @@ -94,7 +94,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Setup Python uses: actions/setup-python@v6 diff --git a/.github/workflows/core-build-test-images.yml b/.github/workflows/core-build-test-images.yml index 7c118c9..a7a9e63 100644 --- a/.github/workflows/core-build-test-images.yml +++ b/.github/workflows/core-build-test-images.yml @@ -39,7 +39,7 @@ jobs: erpnext_version: ${{ steps.resolve.outputs.erpnext_version }} steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Resolve image versions id: resolve @@ -60,7 +60,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Setup QEMU uses: docker/setup-qemu-action@v4 @@ -87,7 +87,7 @@ jobs: echo "NODE_VERSION=${{ inputs.node_version }}" >> "$GITHUB_ENV" - name: Build - uses: docker/bake-action@v7.1.0 + uses: docker/bake-action@v7.3.0 with: source: . push: true diff --git a/.github/workflows/core-publish-images.yml b/.github/workflows/core-publish-images.yml index 4da6bfe..25f404b 100644 --- a/.github/workflows/core-publish-images.yml +++ b/.github/workflows/core-publish-images.yml @@ -40,7 +40,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Setup QEMU uses: docker/setup-qemu-action@v4 @@ -70,7 +70,7 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Push Docker Hub images - uses: docker/bake-action@v7.1.0 + uses: docker/bake-action@v7.3.0 with: push: true set: "*.platform=linux/amd64,linux/arm64" @@ -83,7 +83,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Push GHCR base images - uses: docker/bake-action@v7.1.0 + uses: docker/bake-action@v7.3.0 with: targets: base-images push: true diff --git a/.github/workflows/docs-publish-site.yml b/.github/workflows/docs-publish-site.yml index 32a9fb4..1520341 100644 --- a/.github/workflows/docs-publish-site.yml +++ b/.github/workflows/docs-publish-site.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v6 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3d9ec5c..306d242 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Setup Python uses: actions/setup-python@v6 diff --git a/.github/workflows/pre-commit-autoupdate.yml b/.github/workflows/pre-commit-autoupdate.yml index 9b7dc12..0b830f7 100644 --- a/.github/workflows/pre-commit-autoupdate.yml +++ b/.github/workflows/pre-commit-autoupdate.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Update pre-commit hooks uses: vrslev/pre-commit-autoupdate@v1.0.0 diff --git a/devcontainer-example/devcontainer.json b/devcontainer-example/devcontainer.json index 192b91f..060f534 100644 --- a/devcontainer-example/devcontainer.json +++ b/devcontainer-example/devcontainer.json @@ -10,7 +10,9 @@ "grapecity.gc-excelviewer", "mtxr.sqltools", "mtxr.sqltools-driver-mysql", - "visualstudioexptteam.vscodeintellicode" + "vue.volar", + "esbenp.prettier-vscode", + "charliermarsh.ruff" ], "settings": { "terminal.integrated.profiles.linux": { diff --git a/docs/01-getting-started/02-docker-immutability.md b/docs/01-getting-started/02-docker-immutability.md index c42ba65..d3e6521 100644 --- a/docs/01-getting-started/02-docker-immutability.md +++ b/docs/01-getting-started/02-docker-immutability.md @@ -35,11 +35,11 @@ This allows you to: Installing apps into a running container is **not supported**. -`bench get-app` is an examples of an common but unsupported action. +`bench get-app` and `bench build` are examples of an common but unsupported actions. ### Why? -- Apps are part of the **Docker image** +- Apps and assets are part of the **Docker image** - Runtime changes are lost on container recreation - This ensures reproducibility and stability diff --git a/docs/08-reference/07-how-assets-are-handled.md b/docs/08-reference/07-how-assets-are-handled.md new file mode 100644 index 0000000..27e4d57 --- /dev/null +++ b/docs/08-reference/07-how-assets-are-handled.md @@ -0,0 +1,62 @@ +--- +title: How Assets are handled +--- + +# Assets Reference + +## Problem + +The `sites` directory contains both persistent data (site config, uploaded files, etc.) and build-time artifacts (`sites/assets`). Mounting the entire `sites` directory as a Docker volume causes assets to be persisted alongside config, which leads to: + +- Stale assets surviving image updates +- Asset/manifest mismatches after rebuilds +- Assets being tied to the volume lifecycle rather than the image lifecycle + +## Solution + +Assets are moved out of the `sites` volume during the build process and replaced with a **symlink** later on. This means assets are always served from the image layer, while the rest of `sites` remains persistent. + +### How it works + +During the image build (`Containerfile`), the following is done: + +```dockerfile +RUN cp -r /home/frappe/frappe-bench/sites/assets /home/frappe/frappe-bench/assets && \ + rm -rf /home/frappe/frappe-bench/sites/assets +``` + +This runs **before** the `VOLUME` declaration, so the **`sites` volume does not contain any assets at all**. + +Additionally an `ENTRYPOINT` is added to the images which adds a **symlink** from `assets` to `site\assets`. + +> This is implemented in the entrypoint instead of baking the symlink directly into the image so it also works with pre-existing or already-initialized `sites` volumes. +> Since mounting a volume over `/home/frappe/frappe-bench/sites` hides the image contents at that path, any symlink created during the image build would not be visible inside the mounted volume. The entrypoint recreates the symlink at container startup, ensuring it always exists and automatically repairing older volumes that may not already contain it. + +At runtime: + +``` +/home/frappe/frappe-bench/ +├── assets/ ← image layer (ephemeral, always matches the image) +├── sites/ +│ ├── assets -> /home/frappe/frappe-bench/assets ← symlink +│ ├── common_site_config.json ← persisted in volume +│ └── / ← persisted in volume +└── logs/ ← persisted in volume +``` + +### Volume behavior + +| Path | Persistent | Source | +| -------------------------- | ----------------------- | ---------------------- | +| `sites/` (except assets) | ✅ Yes | Named volume (`sites`) | +| `sites/assets` (symlink) | ✅ Yes (symlink itself) | Named volume (`sites`) | +| `assets/` (symlink target) | ❌ No | Image layer | +| `logs/` | ✅ Yes | Unnamed volume | + +The `sites/assets` symlink is stored inside the persistent `sites` volume, but its target (`/home/frappe/frappe-bench/assets`) comes from the container image. When the container is recreated or upgraded, the assets directory is recreated from the new image, ensuring assets always stay in sync with the running version. + +## Important: `bench build` at runtime + +Running `bench build` inside a running container will write new assets and eventually cause a mismatch between `assets.json` and the actual assets, breaking the UI. This can be recovered by recreating the containers + +> Note: restarting the containers is not sufficient — they need to be recreated to discard the writable layer. diff --git a/example.env b/example.env index 3704b8f..a85e901 100644 --- a/example.env +++ b/example.env @@ -1,6 +1,6 @@ # Reference: https://github.com/frappe/frappe_docker/blob/main/docs/02-setup/04-env-variables.md -ERPNEXT_VERSION=v16.19.1 +ERPNEXT_VERSION=v16.26.1 DB_PASSWORD=123 diff --git a/pwd.yml b/pwd.yml index 1fcde0c..6db6427 100644 --- a/pwd.yml +++ b/pwd.yml @@ -1,6 +1,6 @@ services: backend: - image: frappe/erpnext:v16.19.1 + image: frappe/erpnext:v16.26.1 networks: - frappe_network deploy: @@ -16,7 +16,7 @@ services: MARIADB_ROOT_PASSWORD: admin configurator: - image: frappe/erpnext:v16.19.1 + image: frappe/erpnext:v16.26.1 networks: - frappe_network deploy: @@ -45,7 +45,7 @@ services: - logs:/home/frappe/frappe-bench/logs create-site: - image: frappe/erpnext:v16.19.1 + image: frappe/erpnext:v16.26.1 networks: - frappe_network deploy: @@ -101,7 +101,7 @@ services: - db-data:/var/lib/mysql frontend: - image: frappe/erpnext:v16.19.1 + image: frappe/erpnext:v16.26.1 networks: - frappe_network depends_on: @@ -127,7 +127,7 @@ services: - "8080:8080" queue-long: - image: frappe/erpnext:v16.19.1 + image: frappe/erpnext:v16.26.1 networks: - frappe_network deploy: @@ -146,7 +146,7 @@ services: FRAPPE_REDIS_QUEUE: redis://redis-queue:6379 queue-short: - image: frappe/erpnext:v16.19.1 + image: frappe/erpnext:v16.26.1 networks: - frappe_network deploy: @@ -183,7 +183,7 @@ services: condition: on-failure scheduler: - image: frappe/erpnext:v16.19.1 + image: frappe/erpnext:v16.26.1 networks: - frappe_network deploy: @@ -197,7 +197,7 @@ services: - logs:/home/frappe/frappe-bench/logs websocket: - image: frappe/erpnext:v16.19.1 + image: frappe/erpnext:v16.26.1 networks: - frappe_network deploy: diff --git a/requirements-test.txt b/requirements-test.txt index b3b2b3c..7345f25 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1 +1 @@ -pytest==9.0.3 +pytest==9.1.1