diff --git a/.gitignore b/.gitignore index 0fcb15a..843bbd8 100644 --- a/.gitignore +++ b/.gitignore @@ -390,3 +390,4 @@ Temporary Items docker-compose.yml .env dist +pgdata \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index be5bfe8..6fdd672 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,12 @@ FROM node:12-alpine WORKDIR /usr/src/app -COPY package.json . +COPY *.json . + +COPY src . RUN npm install --quiet -COPY . . +RUN npm run build -CMD ["npm", "run", "start"] +CMD ["npm", "run", "start:prod"] diff --git a/docker-compose.yml b/docker-compose.yml index 5a80d0b..794bdac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: "3.8" services: web: build: . - command: npm run start + command: npm run start:prod volumes: - /usr/src/app environment: @@ -27,3 +27,5 @@ services: - "5432:5432" networks: - default + volumes: + - ./pgdata:/var/lib/postgresql/data/ diff --git a/src/app.module.ts b/src/app.module.ts index 2978258..256b789 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -42,11 +42,11 @@ import { AlbumMusicianModule } from './albummusician/albummusician.module'; password: 'postgres', database: 'vinyls', entities: [Album, CollectorAlbum, Band, Collector, Comment, Musician, Performer, PerformerPrize, Prize, Track,], - dropSchema: true, + dropSchema: false, synchronize: true, keepConnectionAlive: true, migrations: [__dirname + '/migration/**/*{.ts,.js}'], - migrationsRun: false, + migrationsRun: true, }), RecordLabelModule, PrizeModule,