Skip to content

Commit 742e18f

Browse files
committed
Applying some best practices; improving kool.yml and readme
1 parent 6fe9771 commit 742e18f

7 files changed

Lines changed: 38 additions & 9 deletions

File tree

Dockerfile.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FROM kooldev/puppeteer:latest
33
WORKDIR /app
44
ADD . /app
55

6+
ENV NODE_ENV=production
67
RUN yarn install
78

89
CMD ["yarn", "start"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ To get started with development locally (using [`kool`](https://github.com/kool-
77

88
- Fork the repo.
99
- Clone the fork.
10-
- `kool run setup-local` - this will build the local image and install dependencies.
10+
- `kool run yarn install` - this will install dependencies.
1111
- `kool start` - will get up the API on localhost:3000.
1212
- `docker-compose logs -f` - tails the API logs.
1313

kool.services.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ version: '3.8'
22
services:
33
pdf:
44
image: kooldev/puppeteer:latest
5+
restart: unless-stopped
56
command: ['yarn', 'start']
67
working_dir: '/app'
78
user: pptruser

kool.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
scripts:
22
yarn: kool docker node:14-alpine yarn
33

4-
pdf:
5-
- kool run yarn start
6-
7-
setup-local:
8-
- kool run yarn install
9-
104
build:
115
- docker build --no-cache -t kooldev/pdf:latest -f Dockerfile.dist .

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
},
55
"dependencies": {
66
"body-parser": "^1.19.0",
7+
"compression": "^1.7.4",
78
"express": "^4.17.1",
89
"puppeteer": "^5.2.1"
910
},

pdf-service.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ const fs = require('fs');
55
const crypto = require('crypto');
66
const app = express();
77
const bodyParser = require('body-parser');
8+
const compression = require('compression');
89

10+
app.use(compression());
911
app.use(bodyParser.json()); // support json encoded bodies
1012
app.use(bodyParser.urlencoded({
1113
extended: true,

yarn.lock

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
dependencies:
1515
"@types/node" "*"
1616

17-
accepts@~1.3.7:
17+
accepts@~1.3.5, accepts@~1.3.7:
1818
version "1.3.7"
1919
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd"
2020
integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==
@@ -88,6 +88,11 @@ buffer@^5.2.1, buffer@^5.5.0:
8888
base64-js "^1.0.2"
8989
ieee754 "^1.1.4"
9090

91+
bytes@3.0.0:
92+
version "3.0.0"
93+
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048"
94+
integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=
95+
9196
bytes@3.1.0:
9297
version "3.1.0"
9398
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6"
@@ -98,6 +103,26 @@ chownr@^1.1.1:
98103
resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b"
99104
integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==
100105

106+
compressible@~2.0.16:
107+
version "2.0.18"
108+
resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba"
109+
integrity sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==
110+
dependencies:
111+
mime-db ">= 1.43.0 < 2"
112+
113+
compression@^1.7.4:
114+
version "1.7.4"
115+
resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.4.tgz#95523eff170ca57c29a0ca41e6fe131f41e5bb8f"
116+
integrity sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==
117+
dependencies:
118+
accepts "~1.3.5"
119+
bytes "3.0.0"
120+
compressible "~2.0.16"
121+
debug "2.6.9"
122+
on-headers "~1.0.2"
123+
safe-buffer "5.1.2"
124+
vary "~1.1.2"
125+
101126
concat-map@0.0.1:
102127
version "0.0.1"
103128
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
@@ -382,7 +407,7 @@ methods@~1.1.2:
382407
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
383408
integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=
384409

385-
mime-db@1.44.0:
410+
mime-db@1.44.0, "mime-db@>= 1.43.0 < 2":
386411
version "1.44.0"
387412
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92"
388413
integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==
@@ -443,6 +468,11 @@ on-finished@~2.3.0:
443468
dependencies:
444469
ee-first "1.1.1"
445470

471+
on-headers@~1.0.2:
472+
version "1.0.2"
473+
resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.2.tgz#772b0ae6aaa525c399e489adfad90c403eb3c28f"
474+
integrity sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==
475+
446476
once@^1.3.0, once@^1.3.1, once@^1.4.0:
447477
version "1.4.0"
448478
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"

0 commit comments

Comments
 (0)