From 49d9a49cc16525c3d2fc04408cec2df0defd51ac Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Sat, 16 Mar 2024 00:22:44 +0000 Subject: Add dockerfile --- .dockerignore | 3 +++ Dockerfile | 24 ++++++++++++++++++++++++ src/main.ts | 1 + src/storage/entity/stored-file.entity.ts | 2 +- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5c84119 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +dist/ +node_modules/ +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..123df45 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM node:20 AS build + +WORKDIR /srv + +COPY package*.json ./ + +RUN npm install + +COPY . . + +RUN npm run build + + +FROM node:20 AS run + +WORKDIR /srv + +COPY package*.json ./ + +RUN npm install --omit=dev + +COPY --from=build /srv/dist dist/ + +CMD [ "node", "dist/main.js" ] diff --git a/src/main.ts b/src/main.ts index a01b32f..fb1b1bd 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,6 +5,7 @@ import { ValidationPipe } from '@nestjs/common'; async function bootstrap() { const app = await NestFactory.create(AppModule); app.useGlobalPipes(new ValidationPipe()); + app.enableCors(); await app.listen(3000); } bootstrap(); diff --git a/src/storage/entity/stored-file.entity.ts b/src/storage/entity/stored-file.entity.ts index e4b4931..1c4d284 100644 --- a/src/storage/entity/stored-file.entity.ts +++ b/src/storage/entity/stored-file.entity.ts @@ -9,7 +9,7 @@ export class StoredFile { @CreateDateColumn() creationDate: Date; - @Column({ nullable: false }) + @Column({ type: 'text', nullable: false }) b64Contents: string; @OneToOne(() => FileMetadata, (metadata) => metadata.id, { nullable: false }) -- cgit v1.2.3-70-g09d2