Create React App frontend app which talks to an express backend and postgres database.
Run the API and WebApp:
# Build
docker-compose up --build --renew-anon-volumes
# Or just run
docker-compose upBy default the local application directories are mounted as volumes in the containers, with support for hot reload in both.
Because we want to use the container's
node_modulesfolder we mount it as an anonymous volume. This causes problems when you install a new dependency (yarn add xxin the source project) as Docker will reuse the previous anonymous volume.renew-anon-volumestakes care of that for us.
The images expect the source to be mounted as a volume in the container - mainly to support hot reload.
## WebApp
docker build -t anethum-api .
docker run -v ${PWD}:/app -v /app/node_modules -p8881:8881 --rm anethum-api
## Api
docker build -t anethum-webapp .
docker run -v ${PWD}:/app -v /app/node_modules -p 3001:3000 --rm anethum-webappdocker-compose down # or trash from the docker dashboard
docker volume rm anethum_pgdataThe production image builds the webapp and places it in the /public folder of the api image, hosting a single image only.
Uses the heroku.yml file and expects the stack to be container.
DB deployment not yet configured for production!