You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: adminforth/documentation/docs/tutorial/05-deploy.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@ You can use it to build your AdminForth application in Docker container.
19
19
> 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.
20
20
21
21
22
+
22
23
## Building the image
23
24
24
25
Now you can build your image:
@@ -41,6 +42,33 @@ docker run -p 3500:3500 \
41
42
42
43
Now open your browser and go to `http://localhost:3500` to see your AdminForth application running in Docker container.
43
44
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
+
44
72
## Automating deployments with CI
45
73
46
74
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