Skip to content

Commit 205db35

Browse files
authored
Add frontend image example
1 parent 80fca9c commit 205db35

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

docs/install/containers/images/frontend.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,75 @@ This image is **not a base image** to be extended in your projects, but an examp
3333
For an extensive list of environment variables used by the frontend, visit {doc}`/volto/configuration/environmentvariables`.
3434
```
3535

36+
## As an example for your volto project
37+
38+
To use this image as an example of a docker image for your own volto project, you will need to copy the [`Dockerfile`](https://github.com/plone/plone-frontend/blob/main/Dockerfile) file in your project.
39+
40+
In the `Dockerfile` file, replace the `yo @plone/volto` command with the `COPY . /build/plone-frontend` command.
41+
42+
### Create a custom entrypoint
43+
44+
The `plone-frontend` docker image does not have a custom entrypoint file, so for any commands you need to run on docker container start, you will need to create it.
45+
46+
After creating the `entrypoint.sh` file, make sure it has execute permission by running `chmod 755 entrypoint.sh`.
47+
48+
```{note}
49+
Do not forget to add the `exec "$@"` command at the end of the `entrypoint.sh` file, to run the default `yarn start` command.
50+
```
51+
52+
In the `Dockerfile` you will need to add this 2 commands to make the docker container run it on start:
53+
54+
```Dockerfile
55+
COPY entrypoint.sh /
56+
ENTRYPOINT ["/entrypoint.sh"]
57+
```
58+
59+
### Build
60+
61+
Build your new image.
62+
63+
```shell
64+
docker build . -t myfrontend:latest -f Dockerfile
65+
```
66+
67+
### Start it
68+
69+
You can use it in this `docker-compose.yml` file
70+
71+
```yaml
72+
version: "3"
73+
services:
74+
75+
backend:
76+
image: plone/plone-backend:6.0.0a4
77+
# Plone 5.2 series can be used too
78+
# image: plone/plone-backend:5.2.7
79+
ports:
80+
- '8080:8080'
81+
environment:
82+
- SITE=Plone
83+
- 'ADDONS=plone.restapi==8.21.0 plone.volto==4.0.0a3 plone.rest==2.0.0a2 plone.app.iterate==4.0.2 plone.app.vocabularies==4.3.0'
84+
- 'PROFILES=plone.volto:default-homepage'
85+
86+
frontend:
87+
image: 'myfrontend:latest'
88+
ports:
89+
- '3000:3000'
90+
restart: always
91+
environment:
92+
# These are needed in a Docker environment since the
93+
# routing needs to be amended. You can point to the
94+
# internal network alias.
95+
RAZZLE_INTERNAL_API_PATH: http://backend:8080/Plone
96+
RAZZLE_DEV_PROXY_API_PATH: http://backend:8080/Plone
97+
depends_on:
98+
- backend
99+
```
100+
101+
To start, run
102+
```shell
103+
docker-compose up -d
104+
```
36105

37106
## Versions
38107

0 commit comments

Comments
 (0)