diff --git a/api-gateway/Dockerfile b/api-gateway/Dockerfile index 28f6bd37e0..adc2a0e074 100644 --- a/api-gateway/Dockerfile +++ b/api-gateway/Dockerfile @@ -3,6 +3,7 @@ FROM node:18-alpine AS base # Install pnpm globally RUN npm install -g pnpm +RUN npm install -g typescript # Set the working directory in the container WORKDIR /app @@ -22,7 +23,6 @@ COPY tsconfig.json ./ CMD ["pnpm", "dev"] - # Production stage FROM base AS production ENV NODE_ENV=production @@ -33,4 +33,6 @@ COPY tsconfig.json ./ EXPOSE ${PORT} +RUN pnpm build + CMD ["pnpm", "start"] diff --git a/api-gateway/package.json b/api-gateway/package.json index 1bf0b2c6f0..c98676bea2 100644 --- a/api-gateway/package.json +++ b/api-gateway/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "dev": "nodemon --exec ts-node src/app.ts", - "start": "tsc && node dist/app.js", + "start": "node dist/app.js", "build": "tsc", "format": "prettier --write \"src/**/*.ts\"", "test": "echo \"Error: no test specified\" && exit 1", diff --git a/api-gateway/src/app.ts b/api-gateway/src/app.ts index d7c78eb8e8..af92ea0dd6 100644 --- a/api-gateway/src/app.ts +++ b/api-gateway/src/app.ts @@ -17,7 +17,7 @@ app.use(express.json()); app.use(cors()); // configured so any one can use app.options('*', cors()); -// Health check route +// Health check route, redeploy app.get('/', (req, res) => { res.status(200).send('OK'); });