React application base image for production builds.
288
A simple base image for react apps to quickly create a production ready build for apps created using create-react-app and/or using webpack dev server.
Makes the assumption that react router or similar is being used so that 404s will be managed by the client and that any APIs are setup separately with appropriate CORS rules in place.
Expected behaviour is to copy the source of the react application into the new image, run build, copy the output to the hosts content folder and serve. The site's root path '/' will serve the index.html and any requests to '/index.html' will be redirected to '/'.
To consume add a Dockerfile in your react app similar to:
FROM isolid/react-base-image:latest
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build
WORKDIR /server/dist/content/
RUN mv /app/dist/* /server/dist/content/
WORKDIR /server
EXPOSE 8080
CMD [ "npm", "start" ]
With a .dockerignore similar to:
Dockerfile
.dockerignore
.gitignore
.env
README.md
package-lock.json
dist
node_modules
Optional Environmental variables are:
Content type
Image
Digest
sha256:0b05e1795…
Size
75.5 MB
Last updated
almost 3 years ago
docker pull isolid/react-base-image