Skip to content

Commit 72a9cbe

Browse files
committed
docs: update AGENTS.md and 05-deploy.md for clarity and additional instructions
1 parent 9aad834 commit 72a9cbe

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ For impossible states, prefer failing loudly in development rather than hiding t
183183

184184
---
185185

186-
## Code review rules for agents
186+
## Code rules for agents
187187

188188
Before writing extra guards, ask:
189189

adminforth/documentation/docs/tutorial/05-deploy.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ You can use it to build your AdminForth application in Docker container.
1919
> at build time. If you will remove it, your AdminForth application will still work, but will cause some downtime during app restart/redeploy because bundling will happen at runtime after you start the `index.ts` file. When `npx adminforth bundle` command is executed at build time, the call do `bundleNow()` inside of `index.ts` file will actually do nothing.
2020
2121

22+
2223
## Building the image
2324

2425
Now you can build your image:
@@ -41,6 +42,33 @@ docker run -p 3500:3500 \
4142
4243
Now open your browser and go to `http://localhost:3500` to see your AdminForth application running in Docker container.
4344

45+
46+
## Reducing docker image build time
47+
48+
By default `Dockerfile` created by adminforth CLI is configured in a way to rebuild adminforth SPA from scratch on every build:
49+
50+
```
51+
RUN pnpm/npm adminforth bundle
52+
```
53+
54+
If you want to speed up your build, you can use Docker cache for /tmp folder and change this line to:
55+
56+
```
57+
RUN --mount=type=cache,target=/tmp pnpm/npm adminforth bundle
58+
```
59+
60+
This will cache all /tmp folder between builds and speed up the build process significantly. However you need to ensure that your build daemon persists cache from `--mount=type=cache` mounts. Most of vendor CI build daemons like Github actions Default runner will not persist cache between builds so adding `--mount=type=cache` will not help in such case and you need to use dedicated caching solutions.
61+
62+
To verify build performance locally you can do next:
63+
1) Modify any custom vue file
64+
2) Run `docker build -t myadminapp .`. This populates docker cache with bundled SPA
65+
3) Modify same cusom vue file again
66+
4) Run `time docker build -t myadminapp .` and check resulting time.
67+
68+
First we recommend repeat steps 1-4 without `--mount=type=cache` on your docker daemon to see how much time it takes to build without cache and then add `--mount=type=cache` and repeat steps 1-4 again to see the difference in build times. Then experiment with your CI caching solution to achieve similar build times.
69+
70+
71+
4472
## Automating deployments with CI
4573

4674
If you are looking for a professional way to deploy your AdminForth application, you can follow our blog post [how to deploy your AdminForth application with Terraform From GitHub actions](https://adminforth.dev/blog/compose-aws-ec2-ecr-terraform-github-actions/)

0 commit comments

Comments
 (0)