-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add first version of guide of React.js applications
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Deploy React.js Applications | ||
|
||
|
||
## Overview | ||
|
||
The major advantage of React applications is that are just static files to serve to a browser, react.js has its build process that generates .js, .css, and index.html files ready to deploy, cause of this concept we divide the process into three phases: Creating the app, build and deploy | ||
|
||
|
||
## Creating the app | ||
|
||
To create an app, you use the command app create: | ||
|
||
``` bash | ||
$ tsuru app create <app-name> static | ||
``` | ||
|
||
## Build | ||
|
||
Let's create an app using a well-known guide: https://github.com/facebook/create-react-app | ||
|
||
|
||
After creating, let's generate a build directory using the following: | ||
|
||
``` bash | ||
$ npm run build | ||
``` | ||
|
||
|
||
## Deploy | ||
|
||
Well, now we have the build directory with all static files, the next step is to add two files to the build directory: tsuru.yml and nginx.conf, both are suggestions that work for most react apps: | ||
|
||
``` bash | ||
$ cd build | ||
$ wget https://raw.githubusercontent.com/tsuru/platforms/refs/heads/master/examples/static-reactjs/nginx.conf | ||
$ wget https://github.com/tsuru/platforms/blob/master/examples/static-reactjs/tsuru.yml | ||
$ tsuru app deploy -a <app-name> . | ||
``` |