-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
37 lines (25 loc) · 857 Bytes
/
Dockerfile.dev
File metadata and controls
37 lines (25 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Dockerfile.dev - Ambiente de desenvolvimento otimizado
FROM node:24-alpine
RUN apk add --no-cache openssl libc6-compat curl
WORKDIR /app
ENV NODE_ENV=development
ENV CHOKIDAR_USEPOLLING=true
# Copiar arquivos de dependências primeiro (melhor cache)
COPY package*.json ./
COPY prisma ./prisma/
# Instalar dependências
RUN npm ci && npm cache clean --force
# Gerar cliente Prisma
RUN npx prisma generate
# Copiar código fonte por último (muda mais frequentemente)
COPY . .
EXPOSE 3000
# Criar usuário não-root
RUN addgroup -g 1001 -S nodejs \
&& adduser -S nestjs -u 1001 \
&& chown -R nestjs:nodejs /app
USER nestjs
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1
# Comando simplificado (prisma generate já foi feito acima)
CMD ["npm", "run", "start:dev"]