Skip to content

Commit e388f63

Browse files
author
Bruno Krebs
committed
adding Dockerfile and defining README with instructions on how to run the frontend app;
1 parent dc73547 commit e388f63

File tree

3 files changed

+27
-31
lines changed

3 files changed

+27
-31
lines changed

frontend/.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
src
3+
public
4+

frontend/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM nginx
2+
COPY build /usr/share/nginx/html
3+

frontend/README.md

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,33 @@
1-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
1+
# React Tutorial
22

3-
## Available Scripts
3+
[Auth0] has developed this application to support [the React Tutorial published here](https://auth0.com/blog/react-tutorial-building-and-securing-your-first-app/). Head to the article to learn about how everything works.
44

5-
In the project directory, you can run:
5+
## Running the Application
66

7-
### `npm start`
7+
The easiest way to run this application is to issue `npm start` from a terminal pointing to this directory. This command, as you may know, requires Node.js and NPM installed locally. If you don't have those, [you can install them in a few minutes](https://nodejs.org/en/download/).
88

9-
Runs the app in the development mode.<br>
10-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
9+
Another alternative is to use Docker to run the app in a container. To do so, you can issue the following commands:
1110

12-
The page will reload if you make edits.<br>
13-
You will also see any lint errors in the console.
11+
```bash
12+
docker build -t react-tutorial .
1413

15-
### `npm test`
14+
docker run --name react-tutorial -d -p 80:80 react-tutorial
15+
```
1616

17-
Launches the test runner in the interactive watch mode.<br>
18-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
17+
## Releasing a new Docker Image
1918

20-
### `npm run build`
19+
Make sure you are currently logged into Docker and then issue the following commands:
2120

22-
Builds the app for production to the `build` folder.<br>
23-
It correctly bundles React in production mode and optimizes the build for the best performance.
21+
```bash
22+
docker build -t brunokrebs/react-tutorial .
2423

25-
The build is minified and the filenames include the hashes.<br>
26-
Your app is ready to be deployed!
24+
docker push brunokrebs/react-tutorial
25+
```
2726

28-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
27+
In the code snippet above, you will need to replace `brunokrebs` with your own Docker username (unless you are me 😊).
2928

30-
### `npm run eject`
29+
If you do push a Docker image to [Docker Hub](https://hub.docker.com/), then you can use it like this:
3130

32-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33-
34-
If you aren’t 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.
35-
36-
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 you’re on your own.
37-
38-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39-
40-
## Learn More
41-
42-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43-
44-
To learn React, check out the [React documentation](https://reactjs.org/).
31+
```bash
32+
docker run --name react-tutorial -d -p 80:80 brunokrebs/react-tutorial
33+
```

0 commit comments

Comments
 (0)