Puan
0
Çözümler
0
Fastify
Kod:
import Fastify from 'fastify';
const app=Fastify({logger:true});
app.get('/health',async()=>({status:'ok'}));
await app.listen({port:3000,host:'0.0.0.0'});
Dockerfile multi-stage
Kod:
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . . && npm run build
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY package*.json ./
RUN npm ci --only=production
EXPOSE 3000
CMD ["node","dist/index.js"]
