initial copy from uni gitlab

This commit is contained in:
Leonard Krause
2018-04-27 00:58:32 +02:00
parent 5037ffa5a8
commit 0a84a9e2ae
12 changed files with 10999 additions and 0 deletions

13
Dockerfile Normal file
View File

@@ -0,0 +1,13 @@
FROM node:9.3.0 as builder
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn
COPY public ./public
COPY src ./src
RUN export CI=true && yarn test && yarn build
FROM nginx:1.13.7
ADD docker/files/default.conf /etc/nginx/conf.d/
#ADD docker/files/webclient-build.tar.gz /usr/share/nginx/html
COPY --from=builder /usr/src/app/build /usr/share/nginx/html
EXPOSE 80

2320
README.md Normal file

File diff suppressed because it is too large Load Diff

6
docker/Dockerfile Normal file
View File

@@ -0,0 +1,6 @@
FROM nginx:1.13.7
ADD files/default.conf /etc/nginx/conf.d/
ADD files/webclient-build.tar.gz /usr/share/nginx/html
EXPOSE 80

21
docker/files/default.conf Normal file
View File

@@ -0,0 +1,21 @@
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
try_files $uri $uri/ /index.html;
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

56
package.json Normal file
View File

@@ -0,0 +1,56 @@
{
"roleName": "webclient",
"version": "0.5.0",
"private": true,
"dependencies": {
"classnames": "^2.2.5",
"history": "^4.7.2",
"i18next": "^10.2.1",
"i18next-browser-languagedetector": "^2.1.0",
"i18next-xhr-backend": "^1.5.0",
"jwt-decode": "^2.2.0",
"lodash": "^4.17.4",
"material-ui": "^1.0.0-beta.35",
"material-ui-icons": "^1.0.0-beta.17",
"mdi-react": "^2.1.19",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-i18next": "^7.3.0",
"react-maskinput": "^1.0.0",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-router-redux": "^5.0.0-alpha.9",
"react-scripts": "1.0.17",
"react-select": "^1.2.1",
"redux": "^3.7.2",
"redux-form": "^7.2.0",
"redux-persist": "^5.9.1",
"redux-persist-transform-filter": "^0.0.16",
"redux-saga": "^0.16.0",
"typeface-roboto": "^0.0.45"
},
"scripts": {
"start:mockServer": "cd ../mockServer/ && yarn && yarn start &",
"start": "react-scripts start",
"start:develop": "yarn start:mockServer && yarn start",
"build": "react-scripts build",
"run:prod": "./run-build.sh && ./run-prod.sh",
"test": "react-scripts test --env=jsdom",
"test:ci":
"CI=true react-scripts test --env=jsdom --json --outputFile test-results.json",
"eject": "react-scripts eject",
"precommit": "lint-staged",
"prettier": "prettier --write src/**/*.{js,json,css,md} *.{js,json,css,md}"
},
"lint-staged": {
"*.{js,json,css,md}": ["prettier --write", "git add"]
},
"devDependencies": {
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"husky": "^0.14.3",
"lint-staged": "^7.0.0",
"prettier": "^1.11.1"
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

41
public/index.html Normal file
View File

@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

15
public/manifest.json Normal file
View File

@@ -0,0 +1,15 @@
{
"short_name": "React App",
"roleName": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

2
run-test.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
docker run --rm -e CI=true -v "$PWD":/usr/src/app -w /usr/src/app node:9.3.0 /bin/bash -c "yarn install; yarn test"

2
webclient-build-test.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
docker build -t leoek/swt-webclient:test .

58
webclient-build.sh Executable file
View File

@@ -0,0 +1,58 @@
#!/bin/bash
if [[ "$1" != "" || "$PUSH_BUILD" != "" ]]; then
if [[ "$1" != "" ]]; then
PUSH_BUILD="$1"
fi
fi
if [[ "$2" == "true" || $GIT_BRANCH == *"master"* ]]; then
IS_STABLE="true"
fi
if [[ "$3" != "" || "$BUILD_NUMBER" != "" ]] ; then
if [[ "$3" != "" ]]; then
BUILD_NUMBER="$3"
fi
else
echo "a build number is required."
exit 1
fi
docker login --username "$dockerUser" --password "$dockerPw"
versionFile=./src/version.js
packageVersion=$(awk '/version/{gsub(/("|",)/,"",$2);print $2};' $versionFile)
baseTag="leoek/swt-webclient"
newTag="$baseTag:$packageVersion.$BUILD_NUMBER"
echo "Building $newTag"
docker build -t "$newTag" .
# Check the current exit code
if [[ $? > 0 ]]; then
exit 1
fi
if [[ PUSH_BUILD == "true" ]]; then
echo "Pushing $newTag to registry"
docker push "$newTag"
fi
echo "Pushing $baseTag:next to registry"
docker tag $newTag "$baseTag:next"
docker push "$baseTag:next"
#push as new stable if IS_STABLE is set.
if [[ $IS_STABLE == "true" ]]; then
echo "Pushing $baseTag:$packageVersion to registry"
docker tag $newTag "$baseTag:$packageVersion"
docker push "$baseTag:$packageVersion"
echo "Pushing $baseTag:stable to registry"
docker tag $newTag "$baseTag:stable"
docker push "$baseTag:stable"
fi
docker logout

8465
yarn.lock Normal file

File diff suppressed because it is too large Load Diff