File tree Expand file tree Collapse file tree 4 files changed +29
-4
lines changed Expand file tree Collapse file tree 4 files changed +29
-4
lines changed Original file line number Diff line number Diff line change
1
+ assets /scripts /bundle
Original file line number Diff line number Diff line change
1
+ # install dependencies
2
+ FROM node:fermium-alpine
3
+ WORKDIR /app-src
4
+
5
+ RUN npm i -g pnpm
6
+
7
+ COPY assets ./assets
8
+
9
+ COPY package.json ./
10
+ RUN pnpm install
11
+
12
+ COPY apis ./apis
13
+ COPY lib ./lib
14
+ COPY index.js ./index.js
15
+
16
+ RUN pnpm run build
17
+
18
+ USER node
19
+
20
+ ENV PORT=3000
21
+ ENV API="bahn"
22
+
23
+ CMD ["npm" , "start" ]
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import createServer from './lib/index.js'
2
2
import * as bahn from './apis/bahn/index.js'
3
3
import * as bus from './apis/bus/index.js'
4
4
5
- const port = process . env . PORT || 3000
5
+ const port = ( + process . env . PORT ) || 3000
6
6
const apiId = process . env . API || 'bahn'
7
7
8
8
const apis = { bahn, bus }
@@ -14,5 +14,5 @@ const server = createServer(api)
14
14
// start HTTP server
15
15
server . listen ( port , error => {
16
16
if ( error ) return console . error ( error )
17
- console . log ( `HTTP: Listening on ${ port } .` )
17
+ console . log ( `HTTP: Listening on port ${ port } .` )
18
18
} )
Original file line number Diff line number Diff line change 28
28
"author" :
" Julius Tens <[email protected] >" ,
29
29
"scripts" : {
30
30
"build" : " npm run build-bahn && npm run build-bus" ,
31
- "build-bahn" : " browserify 'assets/scripts/bahn.js' > 'assets/scripts/bundle/bahn.js'" ,
32
- "build-bus" : " browserify 'assets/scripts/bus.js' > 'assets/scripts/bundle/bus.js'" ,
31
+ "build-bahn" : " mkdir -p assets/scripts/bundle && browserify 'assets/scripts/bahn.js' > 'assets/scripts/bundle/bahn.js'" ,
32
+ "build-bus" : " mkdir -p assets/scripts/bundle && browserify 'assets/scripts/bus.js' > 'assets/scripts/bundle/bus.js'" ,
33
33
"check-deps" : " depcheck . --ignore-dirs=bundle" ,
34
34
"fix" : " npm run lint -- --fix" ,
35
35
"lint" : " eslint --ignore-pattern /node_modules/ --ignore-pattern /assets/scripts/bundle/ ." ,
36
+ "start" : " node index.js" ,
36
37
"test" : " npm run lint && npm run check-deps"
37
38
},
38
39
"dependencies" : {
You can’t perform that action at this time.
0 commit comments