Skip to content

Commit

Permalink
rebuild frontend app
Browse files Browse the repository at this point in the history
- based on a webpack boilerplate
- remove jQuery
- update docker and jenkins
  • Loading branch information
mickaelchanrion committed Jun 21, 2019
1 parent 4f9a31a commit 9a16ce6
Show file tree
Hide file tree
Showing 46 changed files with 9,813 additions and 3,862 deletions.
13 changes: 6 additions & 7 deletions Jenkinsfile
Expand Up @@ -29,7 +29,7 @@ pipeline {

options {
disableConcurrentBuilds()
buildsDiscarder(logRotator(numToKeepStr: '15'))
buildDiscarder(logRotator(numToKeepStr: '15'))
ansiColor('xterm')
timeout(time: 15, unit: 'MINUTES')
}
Expand Down Expand Up @@ -69,7 +69,7 @@ pipeline {

// Build image, here only express
// TODO: check this
sh "docker-compose -f docker/docker-compose-CI.yml build"
sh "docker-compose -f docker-compose-CI.yml build"
}

post {
Expand All @@ -91,7 +91,7 @@ pipeline {
steps {
// Start application serivces (-d: run in background)
// TODO: check this
sh "docker-compose -f docker/docker-compose-CI.yml up -d"
sh "docker-compose -f docker-compose-CI.yml up -d"
sleep 15
sh "docker ps -a"
}
Expand Down Expand Up @@ -136,7 +136,7 @@ pipeline {
post {
always {
echo "##### Remove stack #####"
sh "docker-compose -f docker/docker-compose-CI.yml down"
sh "docker-compose -f docker-compose-CI.yml down"
sleep 10
}

Expand Down Expand Up @@ -186,7 +186,7 @@ pipeline {
sh """
docker -H $IP_MANAGER_SWARM:2375 stack rm $REPO
docker -H $IP_MANAGER_SWARM:2375 service ls
docker -H $IP_MANAGER_SWARM:2375 stack deploy -c docker/docker-compose-deploy.yml $REPO --with-registry-auth
docker -H $IP_MANAGER_SWARM:2375 stack deploy -c docker-compose-deploy.yml $REPO --with-registry-auth
sleep 5
docker -H $IP_MANAGER_SWARM:2375 stack ls
docker -H $IP_MANAGER_SWARM:2375 service ls
Expand Down Expand Up @@ -309,8 +309,7 @@ def slackNotify(String buildStatus = 'STARTED') {
colorCode = '#EB3831'
}

// def msg = "${buildStatus}: `${env.JOB_NAME}` #${env.BUILD_NUMBER}:\n${env.BUILD_URL}"
def msg = "Here is the env: ${env}"
def msg = "${buildStatus}: `${env.JOB_NAME}` #${env.BUILD_NUMBER}:\n${env.BUILD_URL}"

slackSend(color: colorCode, message: msg)
}
3 changes: 2 additions & 1 deletion docker-compose-CI.yml
Expand Up @@ -5,5 +5,6 @@ services:
image: majdigital/${COMPOSE_PROJECT_NAME}_frontend
container_name: ${COMPOSE_PROJECT_NAME}_frontend
build: ./frontend/
command: sh -c 'npm run build && npm run serve'
ports:
- "8080:8080"
- "3000:8080"
10 changes: 5 additions & 5 deletions docker-compose-deploy.yml
Expand Up @@ -68,10 +68,10 @@ services:
placement:
constraints: [node.role == worker]
labels:
traefik.port: ${PORT}
traefik.port: 8080
traefik.docker.network: 'TRAEFIK_traefik-net'
traefik.frontend.rule: 'Host:${DEPLOY_URL}'
command: sh -c 'yarn run build'
networks:
- default
- TRAEFIK_traefik-net
command: sh -c 'npm run build && npm run serve'
networks:
- default
- TRAEFIK_traefik-net
62 changes: 0 additions & 62 deletions docker-compose-production.yml

This file was deleted.

12 changes: 6 additions & 6 deletions docker-compose.yml
Expand Up @@ -59,12 +59,12 @@ services:
networks:
- app-tier
frontend:
image: majdigital/bigworldgraph_frontend
container_name: bigworldgraph_frontend
build: ./frontend/
image: bigworldgraph_frontend
command: sh -c 'npm run start'
ports:
- "8080:8080"
networks:
- app-tier
- "8080:8080"
volumes:
- ./frontend:/frontend
- /frontend/node_modules
- ./frontend:/usr/app/
- /usr/app/node_modules/
15 changes: 15 additions & 0 deletions frontend/.babelrc
@@ -0,0 +1,15 @@
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": "3.0.0"
}
]
],
"plugins": [
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-proposal-class-properties"
]
}
10 changes: 10 additions & 0 deletions frontend/.browserslistrc
@@ -0,0 +1,10 @@
[production staging]
>5%
last 2 versions
Firefox ESR
not ie < 11

[development]
last 1 chrome version
last 1 firefox version
last 1 edge version
1 change: 1 addition & 0 deletions frontend/.eslintignore
@@ -0,0 +1 @@
src/scripts/vendor
13 changes: 13 additions & 0 deletions frontend/.eslintrc
@@ -0,0 +1,13 @@
{
"env": {
"browser": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"semi": 2
}
}
15 changes: 14 additions & 1 deletion frontend/.gitignore
@@ -1 +1,14 @@
node_modules
# dependencies
node_modules

# production
build

# misc
.DS_Store

npm-debug.log
yarn-error.log
yarn.lock
.yarnclean
.vscode
5 changes: 5 additions & 0 deletions frontend/.travis.yml
@@ -0,0 +1,5 @@
language: node_js
node_js:
- "lts/*"
- "node"
script: npm run build
16 changes: 5 additions & 11 deletions frontend/Dockerfile
@@ -1,15 +1,9 @@
FROM jmfirth/webpack:wheezy
FROM node:10-alpine

ENV NPM_CONFIG_LOGLEVEL warn
# 2: create directory:
RUN mkdir -p /frontend
COPY . /frontend
ENV HOST 0.0.0.0

WORKDIR /frontend
WORKDIR /usr/app/

RUN yarn
# 4: expose port
COPY . .

EXPOSE 8080

CMD ["yarn", "start"]
RUN npm ci
30 changes: 30 additions & 0 deletions frontend/README.md
@@ -0,0 +1,30 @@
# Bigworldgraph frontend

Project based on [this boilerplate](https://github.com/wbkd/webpack-starter).


### Installation

```
npm install
```

### Start Dev Server

```
npm start
```

### Build Prod Version

```
npm run build
```

### Features:

* ES6 Support via [babel](https://babeljs.io/) (v7)
* SASS Support via [sass-loader](https://github.com/jtangelder/sass-loader)
* Linting via [eslint-loader](https://github.com/MoOx/eslint-loader)

When you run `npm run build` we use the [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) to move the css to a separate file. The css file gets included in the head of the `index.html`.

0 comments on commit 9a16ce6

Please sign in to comment.