diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 5eb50b0..ca365a5 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -3,6 +3,10 @@ services: build: context: .. dockerfile: ./docker/server/Dockerfile + args: + - PORT=3000 + - REDIS_HOST=redis + - REDIS_PORT=6379 restart: always environment: - PORT=3000 diff --git a/docker/server/Dockerfile b/docker/server/Dockerfile index 1839171..e870180 100644 --- a/docker/server/Dockerfile +++ b/docker/server/Dockerfile @@ -42,6 +42,15 @@ RUN npm run build FROM base as app +ARG PORT=3000 +ENV PORT=$PORT + +ARG REDIS_HOST=localhost +ENV REDIS_HOST=$REDIS_HOST + +ARG REDIS_PORT=6379 +ENV REDIS_PORT=$REDIS_PORT + COPY --chown=node:node --from=builder /app/dist ./dist ENTRYPOINT ["node", "./dist/main.js"] \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index ca20b0a..2c91cae 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,10 +6,10 @@ import { CustomResponseTransformInterceptor } from './common/customResponse' async function bootstrap() { const app = await NestFactory.create(AppModule, { abortOnError: false }) const config = app.get(ConfigService) - const port = config.get('PORT') + const port = config.get('PORT', 3000) app.enableShutdownHooks() app.useGlobalInterceptors(new CustomResponseTransformInterceptor()) - await app.listen(port) + await app.listen(port, () => console.log(`Listening on port ${port}`)) } bootstrap()