diff --git a/DockerfileServerDictation.dockerfile b/DockerfileServerDictation.dockerfile new file mode 100644 index 0000000..1cfdee4 --- /dev/null +++ b/DockerfileServerDictation.dockerfile @@ -0,0 +1,29 @@ +FROM node:18.13.0-buster AS build-container +WORKDIR /app +RUN mkdir dictation_client \ + && mkdir dictation_server +COPY dictation_client/ dictation_client/ +COPY dictation_server/ dictation_server/ +RUN npm install --force -g n && n 18.13.0 \ + && cd dictation_client \ + && npm ci \ + && npm run build \ + && cd ../dictation_server \ + && npm ci \ + && npm run build \ + && cd .. + +FROM node:18.13.0-alpine +RUN apk --no-cache add tzdata \ + && cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \ + && apk del tzdata \ + && rm -rf /var/cache/apk/* +WORKDIR /app +RUN mkdir build \ + && mkdir dist \ + && mkdir node_modules +COPY --from=build-container app/dictation_client/build/ build/ +COPY --from=build-container app/dictation_server/dist/ dist/ +COPY --from=build-container app/dictation_server/.env ./ +COPY --from=build-container app/dictation_server/node_modules/ node_modules/ +CMD ["node", "./dist/main.js" ] \ No newline at end of file diff --git a/DockerfileServerLicense.dockerfile b/DockerfileServerLicense.dockerfile new file mode 100644 index 0000000..121511b --- /dev/null +++ b/DockerfileServerLicense.dockerfile @@ -0,0 +1,29 @@ +FROM node:18.13.0-buster AS build-container +WORKDIR /app +RUN mkdir license_client \ + && mkdir license_server +COPY license_client/ license_client/ +COPY license_server/ license_server/ +RUN npm install --force -g n && n 18.13.0 \ + && cd license_client \ + && npm ci \ + && npm run build \ + && cd ../license_server \ + && npm ci \ + && npm run build \ + && cd .. + +FROM node:18.13.0-alpine +RUN apk --no-cache add tzdata \ + && cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \ + && apk del tzdata \ + && rm -rf /var/cache/apk/* +WORKDIR /app +RUN mkdir build \ + && mkdir dist \ + && mkdir node_modules +COPY --from=build-container app/license_client/build/ build/ +COPY --from=build-container app/license_server/dist/ dist/ +COPY --from=build-container app/license_server/.env ./ +COPY --from=build-container app/license_server/node_modules/ node_modules/ +CMD ["node", "./dist/main.js" ] \ No newline at end of file diff --git a/dictation_client/src/pages/SamplePage/index.tsx b/dictation_client/src/pages/SamplePage/index.tsx index 41413e3..b588b41 100644 --- a/dictation_client/src/pages/SamplePage/index.tsx +++ b/dictation_client/src/pages/SamplePage/index.tsx @@ -1,7 +1,7 @@ import React from "react"; const SamplePage: React.FC = () => { - return (
hello whorld
) + return (
hello whorld!
Dictation App Service Site
) }; export default SamplePage; diff --git a/dictation_server/src/app.module.ts b/dictation_server/src/app.module.ts index 8af4c4d..cf9bcf0 100644 --- a/dictation_server/src/app.module.ts +++ b/dictation_server/src/app.module.ts @@ -15,20 +15,20 @@ import { LoggerMiddleware } from './common/loggerMiddleware'; envFilePath: ['.env.local', '.env'], isGlobal: true, }), - TypeOrmModule.forRootAsync({ - imports: [ConfigModule], - useFactory: async (configService: ConfigService) => ({ - type: 'mysql', - host: configService.get('DB_ENDPOINT'), - port: configService.get('DB_PORT'), - username: configService.get('DB_USERNAME'), - password: configService.get('DB_PASSWORD'), - database: configService.get('DB_NAME'), - autoLoadEntities: true, // forFeature()で登録されたEntityを自動的にロード - synchronize: false, // trueにすると自動的にmigrationが行われるため注意 - }), - inject: [ConfigService], - }), + // TypeOrmModule.forRootAsync({ + // imports: [ConfigModule], + // useFactory: async (configService: ConfigService) => ({ + // type: 'mysql', + // host: configService.get('DB_ENDPOINT'), + // port: configService.get('DB_PORT'), + // username: configService.get('DB_USERNAME'), + // password: configService.get('DB_PASSWORD'), + // database: configService.get('DB_NAME'), + // autoLoadEntities: true, // forFeature()で登録されたEntityを自動的にロード + // synchronize: false, // trueにすると自動的にmigrationが行われるため注意 + // }), + // inject: [ConfigService], + // }), ], controllers: [HealthController], providers: [], diff --git a/dictation_server/src/health.controller.ts b/dictation_server/src/health.controller.ts index 7df0463..50f6949 100644 --- a/dictation_server/src/health.controller.ts +++ b/dictation_server/src/health.controller.ts @@ -6,6 +6,6 @@ export class HealthController { @Get() @ApiOperation({ operationId: 'checkHealth' }) checkHealth(): string { - return 'OK'; + return 'ODMS Dictation App Service Health OK'; } } diff --git a/dictation_server/src/main.ts b/dictation_server/src/main.ts index 16bf5e2..1c1914c 100644 --- a/dictation_server/src/main.ts +++ b/dictation_server/src/main.ts @@ -26,8 +26,8 @@ async function bootstrap() { const document = SwaggerModule.createDocument(app, options); SwaggerModule.setup('api', app, document); - console.log(process.env.PORT); - - await app.listen(process.env.PORT || 80); + // TODO:検証のためポートを固定 後で直す + // await app.listen(process.env.PORT || 80); + await app.listen(80); } bootstrap(); diff --git a/license_server/src/app.module.ts b/license_server/src/app.module.ts index 8af4c4d..cf9bcf0 100644 --- a/license_server/src/app.module.ts +++ b/license_server/src/app.module.ts @@ -15,20 +15,20 @@ import { LoggerMiddleware } from './common/loggerMiddleware'; envFilePath: ['.env.local', '.env'], isGlobal: true, }), - TypeOrmModule.forRootAsync({ - imports: [ConfigModule], - useFactory: async (configService: ConfigService) => ({ - type: 'mysql', - host: configService.get('DB_ENDPOINT'), - port: configService.get('DB_PORT'), - username: configService.get('DB_USERNAME'), - password: configService.get('DB_PASSWORD'), - database: configService.get('DB_NAME'), - autoLoadEntities: true, // forFeature()で登録されたEntityを自動的にロード - synchronize: false, // trueにすると自動的にmigrationが行われるため注意 - }), - inject: [ConfigService], - }), + // TypeOrmModule.forRootAsync({ + // imports: [ConfigModule], + // useFactory: async (configService: ConfigService) => ({ + // type: 'mysql', + // host: configService.get('DB_ENDPOINT'), + // port: configService.get('DB_PORT'), + // username: configService.get('DB_USERNAME'), + // password: configService.get('DB_PASSWORD'), + // database: configService.get('DB_NAME'), + // autoLoadEntities: true, // forFeature()で登録されたEntityを自動的にロード + // synchronize: false, // trueにすると自動的にmigrationが行われるため注意 + // }), + // inject: [ConfigService], + // }), ], controllers: [HealthController], providers: [], diff --git a/license_server/src/main.ts b/license_server/src/main.ts index 16bf5e2..49e20de 100644 --- a/license_server/src/main.ts +++ b/license_server/src/main.ts @@ -26,8 +26,6 @@ async function bootstrap() { const document = SwaggerModule.createDocument(app, options); SwaggerModule.setup('api', app, document); - console.log(process.env.PORT); - - await app.listen(process.env.PORT || 80); + await app.listen(80); } bootstrap();