๐ฉโ๐ป NestJS ็ dockerfile
ๅปบ็ซๆชๆกโ
ๅจๅฐๆกๅบไธๅปบ็ซไธๅๆชๆก
dockerfile
# node image
FROM node:18-alpine
# ๅปบ็ซapp็ฎ้
WORKDIR /usr/src/app
# ่ค่ฃฝไพ่ณดๆช
COPY package*.json ./
COPY tsconfig*.json ./
# ่ค่ฃฝ็จๅผ็ขผ
COPY . .
# ไธ่ผไพ่ณด
RUN npm install
# ้จๅฑฌๅฐๆก
RUN npm run build
# ๅๅๆๅ
CMD [ "node", "dist/main.js" ]
ๅจๅฐๆกๅบไธๅปบ็ซไธๅๆชๆก
.dockerignore
๏ผไพ้ๆฟพ็จไธๅฐ็ๆชๆก
dockerfile
.dockerignore
node_modules
npm-debug.log
dist
ๅปบ็ซ imageโ
docker build -t nest-app .
ๅๅ nest ๅฎนๅจโ
docker run -p 80:3050 nest-app