update port to default & readme

Signed-off-by: phamthainb <phamthai4643@gmail.com>
This commit is contained in:
phamthainb 2021-05-27 09:46:44 +07:00
parent 07aef36b78
commit 9c19075d6e
3 changed files with 37 additions and 75 deletions

View File

@ -4,16 +4,49 @@ An project deploy a React Application with Nginx
### Command
Build image and run container
#### Build image and run container
```
$ docker-compose up --build -d --rm
$ docker-compose up -d
Building frontend
Sending build context to Docker daemon 1.49MB
Step 1/17 : FROM node:lts AS development
---> 9153ee3e2ced
Step 2/17 : WORKDIR /app
---> Using cache
---> a7909d92148a
Step 3/17 : COPY package.json /app/package.json
---> 2e690dfe99b2
Step 4/17 : COPY package-lock.json /app/package-lock.json
---> dd0132803f43
.....
Step 16/17 : COPY --from=build /app/build .
---> Using cache
---> 447488bdf601
Step 17/17 : ENTRYPOINT ["nginx", "-g", "daemon off;"]
---> Using cache
---> 6372a67cf86f
Successfully built 6372a67cf86f
Successfully tagged react-nginx_frontend:latest
```
Stop and remove the container
#### Expected result
```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b6d00a4974ce react-nginx_frontend "nginx -g 'daemon of…" About a minute ago Up About a minute 0.0.0.0:80->80/tcp, :::80->80/tcp frontend
```
After the application start, navigate to http://localhost in your browser:
![page](./output.png)
#### Stop and remove the container
```
$ docker-compose down
Stopping frontend ... done
Removing frontend ... done
Removing network react-nginx_default
```
### Structure
@ -49,74 +82,3 @@ This base project created with [Create React App](https://github.com/facebook/cr
└── yarn.lock
```
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `yarn start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.
### `yarn test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `yarn build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `yarn eject`
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `yarn build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

View File

@ -5,4 +5,4 @@ services:
context: .
container_name: frontend
ports:
- "3000:80"
- "80:80"

BIN
react-nginx/output.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB