Skip to content

Commit

Permalink
chore: fix dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoPorfirio01 committed Jan 2, 2025
1 parent 794f3d4 commit 1dd8a79
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion apps/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ COPY config/ ./config/

# Copiar código da API
COPY apps/api/ ./apps/api/
COPY apps/api/prisma ./apps/api/prisma
COPY apps/api/prisma ./apps/api/prisma

# Instalar dependências
RUN pnpm install --frozen-lockfile
Expand All @@ -44,6 +44,14 @@ RUN cd apps/api && \
RUN cd apps/api && \
pnpm build

# Modificar a ordem e garantir geração do Prisma
RUN cd apps/api && \
pnpm install --frozen-lockfile && \
pnpm add [email protected] && \
pnpm add @prisma/[email protected] && \
pnpm prisma generate --schema=./prisma/schema.prisma && \
pnpm build

# Imagem de produção
FROM node:20-alpine

Expand Down Expand Up @@ -73,6 +81,13 @@ COPY --from=builder /app/apps/api/prisma ./apps/api/prisma
# Instalar apenas as dependências de produção
RUN pnpm install --prod --frozen-lockfile

# Adicionar estas linhas antes do CMD
RUN cd /app/apps/api && \
pnpm prisma generate --schema=./prisma/schema.prisma

# Garantir que o diretório .prisma existe e tem as permissões corretas
RUN chown -R appuser:appgroup /app/apps/api/node_modules/.prisma

USER appuser

WORKDIR /app/apps/api
Expand Down

0 comments on commit 1dd8a79

Please sign in to comment.