mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-19 05:21:56 -06:00
git actions v2
This commit is contained in:
parent
35aa19853c
commit
71a97e047a
@ -30,7 +30,8 @@ CLEAN_STORE_CONTACTS=true
|
|||||||
CLEAN_STORE_CHATS=true
|
CLEAN_STORE_CHATS=true
|
||||||
|
|
||||||
DATABASE_ENABLED=false
|
DATABASE_ENABLED=false
|
||||||
DATABASE_PROVIDER=mongodb # postgresql, mysql, mongodb
|
DATABASE_PROVIDER=postgresql # postgresql, mysql
|
||||||
|
DATABASE_PROVIDER=mongodb # postgresql, mysql
|
||||||
DATABASE_CONNECTION_URI='mongodb://root:root@mongodb:27017/?authSource=admin&readPreference=primary&ssl=false&directConnection=true'
|
DATABASE_CONNECTION_URI='mongodb://root:root@mongodb:27017/?authSource=admin&readPreference=primary&ssl=false&directConnection=true'
|
||||||
DATABASE_CONNECTION_CLIENT_NAME=evolution
|
DATABASE_CONNECTION_CLIENT_NAME=evolution
|
||||||
DATABASE_SAVE_DATA_INSTANCE=true
|
DATABASE_SAVE_DATA_INSTANCE=true
|
||||||
|
31
Dockerfile
31
Dockerfile
@ -1,22 +1,31 @@
|
|||||||
FROM node:20.7.0-alpine AS builder
|
FROM node:20-bullseye-slim AS base
|
||||||
|
|
||||||
|
RUN apt-get update -y
|
||||||
|
RUN apt-get upgrade -y
|
||||||
|
|
||||||
|
RUN apt-get install -y git tzdata ffmpeg wget curl
|
||||||
|
|
||||||
|
RUN npm i -g npm@latest
|
||||||
|
|
||||||
|
FROM base AS builder
|
||||||
|
|
||||||
LABEL version="1.8.0" description="Api to control whatsapp features through http requests."
|
LABEL version="1.8.0" description="Api to control whatsapp features through http requests."
|
||||||
LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes"
|
LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes"
|
||||||
LABEL contact="contato@agenciadgcode.com"
|
LABEL contact="contato@agenciadgcode.com"
|
||||||
|
|
||||||
RUN apk update && apk upgrade && \
|
|
||||||
apk add --no-cache git tzdata ffmpeg wget curl
|
|
||||||
|
|
||||||
WORKDIR /evolution
|
WORKDIR /evolution
|
||||||
|
|
||||||
COPY ./package.json .
|
COPY ./package.json ./tsconfig.json ./
|
||||||
|
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
RUN chmod +x ./deploy_database.sh
|
||||||
|
|
||||||
ENV DATABASE_CONNECTION_URI=postgres://postgres:pass@localhost/evolution
|
ENV DATABASE_CONNECTION_URI=postgres://postgres:pass@localhost/evolution
|
||||||
RUN npx prisma generate
|
|
||||||
|
RUN ./deploy_database.sh
|
||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
@ -26,11 +35,13 @@ ENV TZ=America/Sao_Paulo
|
|||||||
|
|
||||||
WORKDIR /evolution
|
WORKDIR /evolution
|
||||||
|
|
||||||
|
COPY --from=builder /evolution/package.json ./package.json
|
||||||
|
COPY --from=builder /evolution/package-lock.json ./package-lock.json
|
||||||
|
|
||||||
|
RUN npm install --omit=dev
|
||||||
|
|
||||||
COPY --from=builder /evolution .
|
COPY --from=builder /evolution .
|
||||||
|
|
||||||
ENV DOCKER_ENV=true
|
ENV DOCKER_ENV=true
|
||||||
|
|
||||||
RUN npx prisma migrate deploy
|
ENTRYPOINT ["/bin/bash", "-c", ". ./scripts/run_database_operation_deploy.sh && npm run start:prod" ]
|
||||||
RUN npx prisma generate
|
|
||||||
|
|
||||||
CMD [ "node", "./dist/src/main.js" ]
|
|
||||||
|
16
deploy_database.sh
Normal file
16
deploy_database.sh
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./scripts/env_functions.sh
|
||||||
|
|
||||||
|
if [ "$DOCKER_ENV" != "true" ]; then
|
||||||
|
export_env_vars
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$DATABASE_PROVIDER" == "postgresql" || "$DATABASE_PROVIDER" == "mysql" ]]; then
|
||||||
|
export DATABASE_URL
|
||||||
|
echo "Database URL: $DATABASE_URL"
|
||||||
|
./node_modules/.bin/prisma generate --schema=prisma/$DATABASE_PROVIDER-schema.prisma
|
||||||
|
else
|
||||||
|
echo "Error: Database provider $DATABASE_PROVIDER invalid."
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user