Skip to content
This repository was archived by the owner on Aug 8, 2022. It is now read-only.

Commit ac7123e

Browse files
committed
Initial commit
0 parents  commit ac7123e

19 files changed

+370
-0
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.git/
2+
.gitignore
3+
LICENSE
4+
README.md

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Dependency directory
11+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
12+
app/node_modules
13+
14+
# Webpack autogenerate files
15+
app/dist
16+
17+
.idea

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM node:7.4.0
2+
3+
# download and configure nginx for production use
4+
RUN apt-get update && apt-get install -y nginx
5+
RUN mkdir -p /app/dist && chown www-data:www-data /app/dist
6+
COPY nginx.conf /etc/nginx/nginx.conf
7+
8+
# download dependancies to /tmp
9+
WORKDIR /tmp
10+
COPY app/package.json /tmp/
11+
RUN npm config set registry http://registry.npmjs.org/ &&\
12+
npm install
13+
14+
# copy node_modules from /tmp and copy ./app from host to image
15+
WORKDIR /app
16+
COPY ./app/ /app/
17+
RUN cp -a /tmp/node_modules /app/
18+
19+
# set mode to production by default
20+
ENV NODE_ENV=production
21+
22+
# run webpack in production
23+
CMD ["npm", "run", "production"]
24+
25+
EXPOSE 80

app/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
'presets': ['react', 'es2015']
3+
}

app/package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "generic-react-docker",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"webpack-development": "./node_modules/.bin/webpack-dev-server --config webpack.config.dev.js",
8+
"dev": "echo Open at http://localhost:8080 && npm run webpack-development",
9+
"webpack-production": "NODE_ENV='production' ./node_modules/.bin/webpack --config webpack.config.prod.js",
10+
"production": "npm run webpack-production && echo Open at http://localhost:80 && service nginx start"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://github.com/Driftersk/generic-react-docker"
15+
},
16+
"author": "df",
17+
"license": "MIT",
18+
"bugs": {
19+
"url": "https://github.com/Driftersk/generic-react-docker/issues"
20+
},
21+
"homepage": "https://github.com/Driftersk/generic-react-docker",
22+
"devDependencies": {
23+
"babel-core": "^6.3.26",
24+
"babel-loader": "^6.2.0",
25+
"babel-preset-es2015": "^6.3.13",
26+
"babel-preset-react": "^6.3.13",
27+
"css-loader": "^0.26.1",
28+
"file-loader": "^0.10.0",
29+
"style-loader": "^0.13.1",
30+
"stylus": "^0.54.5",
31+
"stylus-loader": "^2.4.0",
32+
"react-hot-loader": "^1.3.1",
33+
"webpack-dev-server": "^2.3.0"
34+
},
35+
"dependencies": {
36+
"babel-preset-es2015": "^6.3.13",
37+
"react": "^15.4.2",
38+
"react-dom": "^15.4.2",
39+
"webpack": "^2.2.1"
40+
}
41+
}

app/src/css/style.styl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body
2+
background: embedurl('../images/electronics/image.jpg')
3+
color: red

app/src/images/abstract.jpg

55.6 KB
Loading

app/src/images/electronics/image.jpg

28.8 KB
Loading

app/src/index.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="x-ua-compatible" content="ie=edge">
6+
<title>Webpack + React</title>
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<meta name="description" content="Generic Webpack + React">
9+
<meta name="author" content="">
10+
11+
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
12+
<!--[if lt IE 9]>
13+
<script src="https://raw.githubusercontent.com/aFarkas/html5shiv/master/dist/html5shiv.min.js"></script>
14+
<![endif]-->
15+
16+
</head>
17+
<body>
18+
<div id="app"></div>
19+
</body>
20+
<script src="bundle.js"></script>
21+
</html>

app/src/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
4+
import styles from './css/style.styl';
5+
import image from './images/abstract.jpg'
6+
7+
ReactDOM.render(<div>
8+
<pre>yay helpp</pre>
9+
<img src={image} />
10+
</div>, document.getElementById('app'));

0 commit comments

Comments
 (0)