File tree Expand file tree Collapse file tree 5 files changed +32
-8
lines changed
Expand file tree Collapse file tree 5 files changed +32
-8
lines changed Original file line number Diff line number Diff line change @@ -33,4 +33,4 @@ lerna-debug.log*
3333! .vscode /tasks.json
3434! .vscode /launch.json
3535! .vscode /extensions.json
36- /.env
36+ /.env *
Original file line number Diff line number Diff line change @@ -4,7 +4,11 @@ WORKDIR /usr/src/app
44
55COPY package*.json ./
66
7+ COPY entrypoint.sh ./
8+
79RUN npm install
10+ RUN npm install -g db-migrate
11+ RUN npm install -g db-migrate-pg
812
913COPY . .
1014
Original file line number Diff line number Diff line change @@ -6,16 +6,32 @@ services:
66 build : .
77 container_name : " tabbled-server"
88 restart : always
9- command : npm run start:prod
9+ entrypoint : ["/bin/sh", "./entrypoint.sh"]
1010 ports :
1111 - " 3000:3000"
12- networks :
13- - tabbled
1412 environment :
15- - DB_HOST=host.docker.internal
16- - DB_DATABASE=tabbled
13+ - DB_HOST=db
14+ - DB_PORT=5432
1715 extra_hosts :
1816 - " host.docker.internal:host-gateway"
17+ depends_on :
18+ - db
19+
20+ db :
21+ container_name : postgres
22+ image : postgres:12-alpine
23+ ports :
24+ - ' 5432'
25+ volumes :
26+ - pg_data:/data/db
27+ environment :
28+ - POSTGRES_PASSWORD=${DB_PASSWORD}
29+ - POSTGRES_USER=${DB_USER}
30+ - POSTGRES_DB=${DB_DATABASE}
31+
32+ volumes :
33+ pg_data :
34+ external : true
1935
2036
2137networks :
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ db-migrate up
3+ npm start
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ import { AppModule } from './app.module';
33import * as process from "process" ;
44
55async function bootstrap ( ) {
6- const app = await NestFactory . create ( AppModule ) ;
7- await app . listen ( process . env . PORT ) ;
6+ const app = await NestFactory . create ( AppModule ) ;
7+ app . enableCors ( ) ;
8+ await app . listen ( process . env . PORT ) ;
89}
910bootstrap ( ) ;
You can’t perform that action at this time.
0 commit comments