-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1dd8a79
commit 0f75452
Showing
1 changed file
with
6 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,24 +38,15 @@ RUN cd apps/api && \ | |
|
||
# Gerar Prisma Client explicitamente | ||
RUN cd apps/api && \ | ||
pnpm prisma generate --schema=./prisma/schema.prisma | ||
pnpm dlx prisma generate --schema=./prisma/schema.prisma | ||
|
||
# Build após garantir que o Prisma Client foi gerado | ||
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 | ||
|
||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup | ||
|
||
# Instalar OpenSSL na imagem de produção também | ||
RUN apk add --no-cache openssl | ||
|
@@ -81,21 +72,15 @@ 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 | ||
|
||
EXPOSE 3333 | ||
|
||
HEALTHCHECK --interval=30s --timeout=3s \ | ||
CMD wget --no-verbose --tries=1 --spider http://localhost:3333/health || exit 1 | ||
# HEALTHCHECK --interval=30s --timeout=3s \ | ||
# CMD wget --no-verbose --tries=1 --spider http://localhost:3333/health || exit 1 | ||
|
||
RUN pnpm dlx prisma generate --schema=./prisma/schema.prisma | ||
RUN pnpm dlx prisma migrate deploy | ||
|
||
# Comando de inicialização | ||
CMD ["pnpm", "start"] |