Skip to content
forked from inloop/cra-docker

Docker image for running Create React App distributions

License

Notifications You must be signed in to change notification settings

sa1i/cra-docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cra-docker

Create statically built Create React App applications docker images for easy deployment with environment variables support at runtime.

This project was created to solve known problem with CRA in favor of 12 factor apps. See facebook/create-react-app#2353

Usage

All you need to do is get the content of built app (build folder) inside docker image in /app folder.

To get this working firstly create Dockerfile in your project root with content:

FROM inloopx/cra-docker

COPY build /app

then you can call:

# or npm run build
yarn build
docker build -t my-new-app .

Once the build is done, you should have your image ready. To verify it, run the image bind to 8080 port:

docker run --rm -p 8080:80 my-new-app

Now if you open http://localhost:8080 You should see your app.

You can find more in example directory. Also if you use gitlab, don't miss the pipeline configuration file example

docker build -t sa1i/cra-docker:$(git rev-parse --short HEAD) .;docker push sa1i/cra-docker:$(git rev-parse --short HEAD)

About

Docker image for running Create React App distributions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 81.1%
  • Shell 18.9%