refactor: enhance media handling in Baileys service with validation for valid media content

This commit is contained in:
Davidson Gomes
2025-06-23 16:42:24 -03:00
parent af713dee55
commit 8ea4d65bc2
3 changed files with 87 additions and 55 deletions

View File

@@ -1,7 +1,7 @@
FROM node:20-alpine AS builder
RUN apk update && \
apk add --no-cache git ffmpeg wget curl bash openssl dos2unix
apk add --no-cache git ffmpeg wget curl bash openssl
LABEL version="2.3.1" description="Api to control whatsapp features through http requests."
LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes"
@@ -10,24 +10,19 @@ LABEL contact="contato@evolution-api.com"
WORKDIR /evolution
# Define variáveis de ambiente padrão para o build
ENV DOCKER_ENV=true
ENV DATABASE_PROVIDER=postgresql
ENV DATABASE_URL=postgresql://user:password@localhost:5432/evolution
# Copia arquivos de configuração primeiro
COPY ./package*.json ./
COPY ./tsconfig.json ./
COPY ./tsup.config.ts ./
COPY ./package.json ./tsconfig.json ./
# Instala todas as dependências (incluindo dev para build)
RUN npm ci --silent
RUN npm install
# Copia código fonte
COPY ./src ./src
COPY ./public ./public
COPY ./prisma ./prisma
COPY ./manager ./manager
COPY ./.env.example ./.env
COPY ./runWithProvider.js ./
COPY ./tsup.config.ts ./
# Copia scripts Docker
COPY ./Docker ./Docker
@@ -45,9 +40,6 @@ RUN ./Docker/scripts/generate_database.sh
# Build do projeto
RUN npm run build
# Remove devDependencies para reduzir tamanho
RUN npm prune --production
FROM node:20-alpine AS final
RUN apk update && \
@@ -66,13 +58,13 @@ COPY --from=builder /evolution/dist ./dist
COPY --from=builder /evolution/prisma ./prisma
COPY --from=builder /evolution/manager ./manager
COPY --from=builder /evolution/public ./public
COPY --from=builder /evolution/.env ./.env
COPY --from=builder /evolution/Docker ./Docker
COPY --from=builder /evolution/runWithProvider.js ./runWithProvider.js
COPY --from=builder /evolution/tsup.config.ts ./tsup.config.ts
# Cria arquivo .env vazio - as variáveis virão do Railway
RUN touch .env
ENV DOCKER_ENV=true
EXPOSE 8080
ENTRYPOINT ["/bin/bash", "-c", ". ./Docker/scripts/deploy_database.sh && npm run start:prod" ]
ENTRYPOINT ["/bin/bash", "-c", ". ./Docker/scripts/deploy_database.sh && npm run start:prod" ]