1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00

Add start script for Docker image, pre-commit lint check, package.json scripts cleanup

This commit is contained in:
Maksim Eltyshev 2020-04-24 21:44:54 +05:00
parent 5e17a4880a
commit e0dee1efef
11 changed files with 1236 additions and 11 deletions

2
.gitignore vendored
View file

@ -1,2 +1,4 @@
node_modules
.vscode .vscode
.DS_Store .DS_Store

View file

@ -3,8 +3,8 @@ FROM node:alpine AS server-builder
WORKDIR /app WORKDIR /app
RUN apk add vips-dev fftw-dev build-base python --no-cache \ RUN apk add vips-dev fftw-dev build-base python --no-cache \
--repository https://alpine.global.ssl.fastly.net/alpine/v3.10/community/ \ --repository https://alpine.global.ssl.fastly.net/alpine/v3.10/community/ \
--repository https://alpine.global.ssl.fastly.net/alpine/v3.10/main/ --repository https://alpine.global.ssl.fastly.net/alpine/v3.10/main/
COPY server/package.json server/package-lock.json ./ COPY server/package.json server/package-lock.json ./
@ -25,7 +25,7 @@ RUN npm run build
FROM node:alpine FROM node:alpine
RUN apk add bash vips --no-cache \ RUN apk add bash vips --no-cache \
--repository https://alpine.global.ssl.fastly.net/alpine/v3.10/community/ --repository https://alpine.global.ssl.fastly.net/alpine/v3.10/community/
WORKDIR /app WORKDIR /app
@ -33,6 +33,9 @@ COPY --from=server-builder /app/node_modules node_modules
COPY server . COPY server .
COPY --from=client-builder /app/build public COPY --from=client-builder /app/build public
COPY --from=client-builder /app/build/index.html views COPY --from=client-builder /app/build/index.html views
COPY docker-start.sh start.sh
RUN chmod +x start.sh
ENV BASE_URL DATABASE_URL ENV BASE_URL DATABASE_URL
@ -41,4 +44,4 @@ VOLUME /app/public/attachments
EXPOSE 1337 EXPOSE 1337
CMD ["npm", "start"] CMD ["./start.sh"]

View file

@ -51,6 +51,12 @@ Demo user: demo@demo.demo demo
git clone https://github.com/plankanban/planka.git git clone https://github.com/plankanban/planka.git
``` ```
Root folder:
```
npm install
```
Server folder: Server folder:
``` ```
@ -61,7 +67,7 @@ npm install
npm run db:migrate npm run db:migrate
npm run db:seed npm run db:seed
npm run start:dev npm run start
``` ```
Client folder: Client folder:

View file

@ -6,7 +6,7 @@ services:
command: > command: >
bash -c bash -c
"for i in `seq 1 30`; do "for i in `seq 1 30`; do
npm start && ./start.sh &&
s=$$? && break || s=$$?; s=$$? && break || s=$$?;
echo \"Tried $$i times. Waiting 5 seconds...\"; echo \"Tried $$i times. Waiting 5 seconds...\";
sleep 5; sleep 5;

4
docker-start.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
node db/init.js \
&& node app.js --prod $@

1184
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -8,5 +8,22 @@
"url": "https://github.com/plankanban/planka.git" "url": "https://github.com/plankanban/planka.git"
}, },
"license": "MIT", "license": "MIT",
"author": "Maksim Eltyshev" "author": "Maksim Eltyshev",
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"client/**/*.{js,jsx}": [
"npm run lint --prefix client"
],
"server/**/*.js": [
"npm run lint --prefix server"
]
},
"devDependencies": {
"husky": "^4.2.5",
"lint-staged": "^10.1.7"
}
} }

View file

@ -28,6 +28,11 @@ module.exports = {
}, },
async fn(inputs, exits) { async fn(inputs, exits) {
// TODO: allow over HTTP without subscription
if (!this.req.isSocket) {
return this.res.badRequest();
}
const project = await Project.findOne(inputs.projectId); const project = await Project.findOne(inputs.projectId);
if (!project) { if (!project) {
@ -38,6 +43,8 @@ module.exports = {
const board = await sails.helpers.createBoard(project, values, this.req); const board = await sails.helpers.createBoard(project, values, this.req);
sails.sockets.join(this.req, `board:${board.id}`); // TODO: only when subscription needed
return exits.success({ return exits.success({
item: board, item: board,
included: { included: {

View file

@ -46,7 +46,6 @@ module.exports = {
values: { values: {
coverAttachmentId: attachment.id, coverAttachmentId: attachment.id,
}, },
request: inputs.request,
}); });
} }

View file

@ -10,6 +10,10 @@ module.exports = {
connection: process.env.DATABASE_URL, connection: process.env.DATABASE_URL,
migrations: { migrations: {
tableName: 'migration', tableName: 'migration',
directory: path.join(__dirname, 'migrations'),
},
seeds: {
directory: path.join(__dirname, 'seeds'),
}, },
wrapIdentifier: (value, origImpl) => origImpl(_.snakeCase(value)), wrapIdentifier: (value, origImpl) => origImpl(_.snakeCase(value)),
}; };

View file

@ -5,12 +5,11 @@
"scripts": { "scripts": {
"console": "dotenv sails console", "console": "dotenv sails console",
"custom-tests": "echo \"(No other custom tests yet.)\" && echo", "custom-tests": "echo \"(No other custom tests yet.)\" && echo",
"db:init": "cd db && node init.js",
"db:migrate": "knex migrate:latest --cwd db", "db:migrate": "knex migrate:latest --cwd db",
"db:seed": "knex seed:run --cwd db", "db:seed": "knex seed:run --cwd db",
"lint": "eslint . --max-warnings=0 --report-unused-disable-directives && echo '✔ Your .js files look good.'", "lint": "eslint . --max-warnings=0 --report-unused-disable-directives && echo '✔ Your .js files look good.'",
"start": "npm run db:init && NODE_ENV=production node app.js", "start": "nodemon",
"start:dev": "nodemon", "start:prod": "node app.js --prod",
"test": "npm run lint && npm run custom-tests && echo 'Done.'" "test": "npm run lint && npm run custom-tests && echo 'Done.'"
}, },
"eslintConfig": { "eslintConfig": {