Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit 5761fd6

Browse files
authored
Dockerize now-cloud deploy (#29)
* chore: add license field to package.json * perf(server): replace nodegit for async git clone exec - Remove nodegit dependencies and pains * chore(now): extract now-cloud configuration to now.json - Due to the deployment migration (node -> docker), to make sure the config work properly * ci(now-cloud): replace node deploy in favor of docker - The deployment by Dockerfile definition opens more options, more customizable... and also good learning * ci(dockerfile): include good practices
1 parent 0068594 commit 5761fd6

File tree

7 files changed

+61
-529
lines changed

7 files changed

+61
-529
lines changed

Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM node:9-alpine
2+
3+
LABEL maintainer="[email protected]"
4+
5+
# install git
6+
RUN apk update && apk upgrade && \
7+
apk add --no-cache bash git openssh
8+
9+
WORKDIR /app
10+
11+
# copy sources
12+
COPY . /app
13+
14+
# install dependencies and build dist
15+
RUN npm run install:all && \
16+
npm run build
17+
18+
# expose server
19+
EXPOSE 443
20+
21+
CMD ["npm", "run", "start"]

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.18.0",
44
"description": "vuegg UI",
55
"author": "alxpez",
6+
"license" : "MIT",
67
"private": false,
78
"scripts": {
89
"dev": "node build/dev-server.js",

now.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "vuegg",
3+
"alias": "vuegg",
4+
"public": true,
5+
"type": "docker",
6+
"dotenv": true,
7+
"scale": {
8+
"sfo1": {
9+
"min": 2,
10+
"max": 2
11+
}
12+
}
13+
}

package.json

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
"version": "0.19.0",
44
"description": "vuejs GUI generator",
55
"author": "alxpez",
6+
"license" : "MIT",
67
"scripts": {
78
"oauth": "node oauth-config.js",
89
"vuegg": "npm run install:all && npm run build && npm run start",
910
"vuegg:test": "npm run build && npm run start",
1011
"install:all": "npm run install:client && npm run install:server",
11-
"install:client": "cd client && npm install",
12+
"install:client": "cd client && npm install && npm rebuild node-sass",
1213
"install:server": "cd server && npm install",
1314
"client": "cd client && npm run dev",
1415
"server": "cd server && npm run dev",
1516
"build": "cd client && npm run build",
1617
"start": "cd server && npm run start",
17-
"now-build": "npm run install:server",
18-
"deploy": "npm run build && now -f -p",
18+
"deploy": "now -f && now alias",
19+
"release": "standard-version",
1920
"commit": "commit",
20-
"commitmsg": "commitlint -e $GIT_PARAMS",
21-
"release": "standard-version"
21+
"commitmsg": "commitlint -e $GIT_PARAMS"
2222
},
2323
"commitlint": {
2424
"extends": [
@@ -30,16 +30,6 @@
3030
"commit": true
3131
}
3232
},
33-
"now": {
34-
"alias": "vuegg",
35-
"dotenv": true,
36-
"scale": {
37-
"sfo1": {
38-
"min": 2,
39-
"max": 2
40-
}
41-
}
42-
},
4333
"engines": {
4434
"node": ">= 8.0.0",
4535
"npm": ">= 5.0.0"

server/api/generator/environment/prepare.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require('path')
22
const shell = require('shelljs')
3-
const Git = require("nodegit");
3+
const util = require('util')
44

55
/**
66
* Prepares the environment and clones the scaffold-project for the generation tasks.
@@ -36,7 +36,8 @@ async function _prepare (content, rootDir) {
3636
let repo = 'https://github.com/vuegg/vuegg-scaffold.git'
3737

3838
try {
39-
await Git.Clone(repo, targetDir)
39+
const asyncExec = util.promisify(shell.exec)
40+
await asyncExec('git clone '.concat(repo).concat(' ').concat(targetDir), {async:true})
4041
} catch (e) {
4142
console.error('\n> Ups! Could not complete the scaffolding...\n' + e)
4243
}

0 commit comments

Comments
 (0)