https://github.com/fly-apps/hello-create-react-app
https://github.com/fly-apps/hello-create-react-app
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fly-apps/hello-create-react-app
- Owner: fly-apps
- Created: 2022-09-28T14:30:30.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-28T14:35:40.000Z (almost 4 years ago)
- Last Synced: 2024-11-17T00:27:06.601Z (over 1 year ago)
- Language: JavaScript
- Size: 295 KB
- Stars: 7
- Watchers: 10
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fly + Create React App = ❤️
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
This serves as a simple way to teach React developers how to deploy on Fly.io
## How to deploy this?
If you just want to deploy this project all you need is `fly launch` and accept copying the configuration.
```sh
$ fly launch
An existing fly.toml file was found
? Would you like to copy its configuration to the new app? Yes
Creating app in /path/to/fly-create-react-app
Scanning source code
Detected a Dockerfile app
? App Name (leave blank to use an auto-generated name): create-react-app-on-fly
? Select organization: Lubien (personal)
? Select region: gru (São Paulo)
Created app create-react-app-on-fly in organization personal
Wrote config file fly.toml
? Would you like to set up a Postgresql database now? No
? Would you like to deploy now? Yes
Deploying create-react-app-on-fly
==> Validating app configuration
--> Validating app configuration done
...
```
## How to add this to my other React project?
The important files here are the Dockerfile, `fly.toml`, `.dockerignore` and the `nginx` folder.
Copy those to your project and you should be good to go.
## How does this work?
This setup uses a Dockerfile with NodeJS to build your project using `npm run build` then we copy the built files
to a Nginx image to serve all statics handling pretty URLs.
Worth mentioning we added `[[statics]]` to the `fly.toml` to cache statics too.