Deploy Dockerized React App
-
Hi All,
I'm fairly new to Cloudron and Docker and I'm trying to deploy a simple React app which I created using npx create-react-app.
- Dockerfile Which I found from one of the many examples online (each of which is slightly different)
- CloudronManifest
I can create the container locally with port 80:80 and access it from my browser, however when I deploy to Cloudron I get the following errors:
Oct 14 22:40:21 /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration Oct 14 22:40:21 /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ Oct 14 22:40:21 /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh Oct 14 22:40:21 10-listen-on-ipv6-by-default.sh: error: can not modify /etc/nginx/conf.d/default.conf (read-only file system?) Oct 14 22:40:21 /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh Oct 14 22:40:21 /docker-entrypoint.sh: Configuration complete; ready for start up Oct 14 22:40:21 2020/10/14 21:40:21 [emerg] 1#1: mkdir() "/var/cache/nginx/client_temp" failed (30: Read-only file system) Oct 14 22:40:21 nginx: [emerg] mkdir() "/var/cache/nginx/client_temp" failed (30: Read-only file system)
I can see it's something to do with the file Nginx is trying to edit but I am unsure how to fix it.
There are some web examples on the Cloudron Gitlab however they seem to be running the app in development mode instead of actually building it.Apologies in advance if I'm just being a Docker noob and this is nothing to do with Cloudron
Thanks,
Ross
-
@rossmaclean On Cloudron, the containers run on a read only file system. They can write only to specific locations at runtime - see https://docs.cloudron.io/custom-apps/guide/#read-only .
For configuring nginx, I think https://docs.cloudron.io/custom-apps/guide/#nginx is the info you are looking for. You can see how it's done in the teamspeak package.
- Make a nginx.conf in your repo - https://git.cloudron.io/cloudron/teamspeak-app/-/blob/master/nginx.conf (in your case, you have to fix the port to 80 from 8000).
- Add the config to a site - https://git.cloudron.io/cloudron/teamspeak-app/-/blob/master/Dockerfile#L34