File tree Expand file tree Collapse file tree 5 files changed +17
-67
lines changed Expand file tree Collapse file tree 5 files changed +17
-67
lines changed Original file line number Diff line number Diff line change 1
1
FROM node:10-alpine
2
2
3
- RUN mkdir -p src/
3
+ RUN mkdir -p /src
4
4
5
- COPY . src/
5
+ COPY package.json src/package.json
6
+ COPY package-lock.json src/package-lock.json
6
7
7
8
WORKDIR /src
8
9
9
- RUN npm i
10
+ RUN npm install --only=production
11
+
12
+ COPY . /src
10
13
11
14
CMD npm start
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ docker run -d -p 5432:5432 --name postgres \
34
34
docker run -p 3000:3000 \
35
35
--link postgres:postgres \
36
36
-e POSTGRES_HOST=postgres:mysecretpassword@postgres:5432 \
37
+ -e POSTGRES_DB=heroes \
37
38
erickwendel/nodejs-with-postgres-api-example:latest
38
39
```
39
40
Original file line number Diff line number Diff line change @@ -19,7 +19,13 @@ const server = new Hapi.Server(
19
19
) ;
20
20
}
21
21
const sequelize = new Sequelize (
22
- `postgres://${ process . env . POSTGRES_HOST } /heroes` ,
22
+ `postgres://${ process . env . POSTGRES_HOST } /${ process . env . POSTGRES_DB || "heroes" } ` ,
23
+ {
24
+ ssl : process . env . POSTGRES_SSL ,
25
+ dialectOptions : {
26
+ ssl : process . env . POSTGRES_SSL ,
27
+ } ,
28
+ }
23
29
) ;
24
30
await sequelize . authenticate ( ) ;
25
31
console . log ( "postgres is running" ) ;
Original file line number Diff line number Diff line change 16
16
"joi" : " 14.3.1" ,
17
17
"pg" : " 7.10.0" ,
18
18
"pg-hstore" : " 2.3.2" ,
19
+ "pm2" : " 3.5.0" ,
19
20
"sequelize" : " 5.6.1" ,
20
- "vision" : " 5.4.4" ,
21
- "pm2" : " ^3.5.0"
21
+ "vision" : " 5.4.4"
22
22
},
23
- "devDependencies" : {
24
- }
23
+ "devDependencies" : {}
25
24
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments