attempting to make docker package smaller, and take less memory

This commit is contained in:
Amruth Pillai 2022-03-03 20:05:22 +01:00
parent 5fc7a32c67
commit ed6578b052
No known key found for this signature in database
GPG Key ID: E3C57DF9B80855AD
6 changed files with 190 additions and 235 deletions

View File

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/playwright:focal AS build
FROM node AS build
RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm
@ -18,9 +18,16 @@ RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm
WORKDIR /app
COPY --from=build /app/package.json .
COPY --from=build /app/pnpm-lock.yaml .
COPY --from=build /app/dist ./dist
RUN pnpm install --frozen-lockfile --prod
# Expose App
EXPOSE 3000
# Export Server
EXPOSE 3100
CMD [ "pnpm", "start" ]

View File

@ -2,20 +2,25 @@ import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Resume } from '@/resume/entities/resume.entity';
import { User } from '@/users/entities/user.entity';
@Module({
imports: [
TypeOrmModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
useFactory: async (configService: ConfigService) => ({
type: 'postgres',
host: configService.get<string>('postgres.host'),
port: configService.get<number>('postgres.port'),
username: configService.get<string>('postgres.username'),
password: configService.get<string>('postgres.password'),
database: configService.get<string>('postgres.database'),
synchronize: configService.get<string>('app.environment') === 'development',
autoLoadEntities: true,
synchronize: true,
entities: [User, Resume],
migrations: [__dirname + 'migrations'],
cli: { migrationsDir: __dirname + 'migrations' },
}),
}),
],

View File

@ -5,7 +5,7 @@ import { mkdir, unlink, writeFile } from 'fs/promises';
import { nanoid } from 'nanoid';
import { join } from 'path';
import { PDFDocument } from 'pdf-lib';
import { Browser, chromium } from 'playwright';
import { Browser, chromium } from 'playwright-chromium';
export const DELETION_TIME = 10 * 1000; // 10 seconds

View File

@ -20,7 +20,6 @@
},
"private": true,
"dependencies": {
"@changesets/cli": "^2.21.0",
"@date-io/dayjs": "^2.13.1",
"@emotion/css": "^11.7.1",
"@emotion/react": "^11.8.1",
@ -39,19 +38,22 @@
"@nestjs/passport": "^8.2.1",
"@nestjs/platform-express": "^8.4.0",
"@nestjs/schedule": "^1.0.2",
"@nestjs/schematics": "^8.0.7",
"@nestjs/serve-static": "^2.2.2",
"@nestjs/testing": "^8.4.0",
"@nestjs/typeorm": "^8.0.3",
"@nrwl/next": "13.8.3",
"@nrwl/tao": "13.8.3",
"@nrwl/workspace": "13.8.3",
"@reduxjs/toolkit": "^1.8.0",
"autoprefixer": "^10.4.2",
"axios": "^0.26.0",
"bcrypt": "^5.0.1",
"cache-manager": "^3.6.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.2",
"clsx": "^1.1.1",
"concurrently": "^7.0.0",
"cookie-parser": "^1.4.6",
"core-js": "^3.21.1",
"csvtojson": "^2.0.10",
"dayjs": "^1.10.8",
"downloadjs": "^1.4.7",
@ -73,7 +75,7 @@
"passport-local": "^1.0.0",
"pdf-lib": "^1.17.1",
"pg": "^8.7.3",
"postcss": "^8.4.7",
"playwright-chromium": "^1.19.2",
"react": "17.0.2",
"react-beautiful-dnd": "^13.1.0",
"react-colorful": "^5.5.1",
@ -92,8 +94,6 @@
"redux": "^4.1.2",
"redux-persist": "^6.0.0",
"redux-saga": "^1.1.3",
"reflect-metadata": "^0.1.13",
"regenerator-runtime": "0.13.9",
"remark-gfm": "^3.0.1",
"rxjs": "^7.5.4",
"sharp": "^0.30.2",
@ -106,7 +106,7 @@
"devDependencies": {
"@babel/core": "^7.17.5",
"@babel/preset-env": "^7.16.11",
"@nestjs/schematics": "^8.0.7",
"@changesets/cli": "^2.21.0",
"@nestjs/testing": "^8.4.0",
"@nrwl/cli": "13.8.3",
"@nrwl/eslint-plugin-nx": "13.8.3",
@ -116,9 +116,7 @@
"@nrwl/node": "13.8.3",
"@nrwl/nx-cloud": "latest",
"@nrwl/react": "13.8.3",
"@nrwl/tao": "13.8.3",
"@nrwl/web": "13.8.3",
"@nrwl/workspace": "13.8.3",
"@testing-library/react": "12.1.3",
"@testing-library/react-hooks": "7.0.2",
"@types/bcrypt": "^5.0.0",
@ -140,9 +138,10 @@
"@types/webfontloader": "^1.6.34",
"@typescript-eslint/eslint-plugin": "~5.12.1",
"@typescript-eslint/parser": "~5.10.2",
"autoprefixer": "^10.4.2",
"babel-jest": "27.5.1",
"babel-loader": "^8.2.3",
"concurrently": "^7.0.0",
"core-js": "^3.21.1",
"csstype": "^3.0.11",
"eslint": "~8.10.0",
"eslint-config-next": "12.1.0",
@ -155,12 +154,13 @@
"eslint-plugin-unused-imports": "^2.0.0",
"husky": "^7.0.4",
"jest": "27.5.1",
"playwright": "^1.19.2",
"postcss": "^8.4.7",
"prettier": "^2.5.1",
"prettier-plugin-tailwindcss": "^0.1.8",
"react-test-renderer": "17.0.2",
"reflect-metadata": "^0.1.13",
"regenerator-runtime": "0.13.9",
"sass": "^1.49.9",
"ts-jest": "27.1.3",
"typescript": "~4.5.5",
"webpack": "^5.70.0"
}

File diff suppressed because it is too large Load Diff