This commit is contained in:
S.long 2020-05-07 12:13:18 +07:00
parent e61dca1b60
commit acb30e7017
7 changed files with 77 additions and 2 deletions

14
Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM node:13.14.0-alpine3.10
WORKDIR /home/app/app
COPY build public
COPY ./server.js ./server.js
COPY ./server.package.json ./package.json
ENV PORT=8000
RUN npm install express
CMD npm run start
EXPOSE 8000

9
build.sh Executable file
View File

@ -0,0 +1,9 @@
yarn build
heroku login
heroku container:login
heroku container:push web
heroku container:release web

17
hook.sh Normal file
View File

@ -0,0 +1,17 @@
@!/bin/sh
API_KEY=d282975b-22ba-48f1-9bbe-a1a22bec5543
echo "Push Project To Heroku"
echo "-- Start Login Heroku Containers Registry"
HEROKU_API_KEY=$API_KEY heroku container:login
echo "-- Start Push App To Heroku"
HEROKU_APP_KEY=$API_KEY heroku container:push web
echo "-- Start Release App on Heroku"
HEROKU_API_KEY=$API_KEY heroku container:release web
echo "-- Open Browser Result "
HEROKU_API_KEY=$API_KEY heroku open

View File

@ -1,7 +1,7 @@
const path = require('path');
const express = require('express');
const app = express();
const publicPath = path.join(__dirname, '.', 'build');
const publicPath = path.join(__dirname, '.', 'public');
const port = process.env.PORT || 3000;
app.use(express.static(publicPath));
app.get('*', (req, res) => {

35
server.package.json Normal file
View File

@ -0,0 +1,35 @@
{
"name": "react-heroku",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
},
"scripts": {
"start-app": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"start": "node server.js"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

View File

@ -4,7 +4,7 @@ import './App.css';
function App() {
return (
<h1>React My </h1>
<h1>React My DOCKER Second Time</h1>
)
return (

0
test1.txt Normal file
View File