diff --git a/Dockerfile b/Dockerfile index ca61b39a..ce26f53d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20-alpine AS builder +FROM node:20-alpine AS base RUN apk update && \ apk add git ffmpeg wget curl bash openssl @@ -9,6 +9,8 @@ LABEL contact="contato@atendai.com" WORKDIR /evolution +FROM base AS builder + COPY ./package.json ./tsconfig.json ./ RUN npm install @@ -29,6 +31,17 @@ RUN ./Docker/scripts/generate_database.sh RUN npm run build +FROM base AS dev + +RUN apk update && \ + apk add git ffmpeg wget curl bash openssl + +COPY . . + +RUN npm install + +ENTRYPOINT ["/bin/bash", "-c", "npm run dev:server" ] + FROM node:20-alpine AS final RUN apk update && \ diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index 2ca3424e..354517bb 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -1,13 +1,13 @@ services: api: - container_name: evolution_api - image: evolution/api:local - build: . + build: + target: dev restart: always ports: - 8080:8080 volumes: - evolution_instances:/evolution/instances + - ./:/evolution networks: - evolution-net env_file: diff --git a/docker-compose.yaml b/docker-compose.yaml index 9a60a9a9..1572d828 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,10 @@ services: api: + build: + context: . + dockerfile: Dockerfile + target: final container_name: evolution_api - image: atendai/evolution-api:homolog restart: always depends_on: - redis @@ -34,13 +37,13 @@ services: image: postgres:15 networks: - evolution-net - command: ["postgres", "-c", "max_connections=1000", "-c", "listen_addresses=*"] + #command: ["postgres", "-c", "max_connections=1000", "-c", "listen_addresses=*"] restart: always ports: - 5432:5432 environment: - - POSTGRES_USER=user - - POSTGRES_PASSWORD=pass + - POSTGRES_USER=evolution + - POSTGRES_PASSWORD=postgres - POSTGRES_DB=evolution - POSTGRES_HOST_AUTH_METHOD=trust volumes: