Skip to content

ajuste docker #1686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-alpine AS builder
FROM node:20-alpine AS base

RUN apk update && \
apk add --no-cache git ffmpeg wget curl bash openssl
Expand All @@ -9,6 +9,8 @@ LABEL contact="contato@evolution-api.com"

WORKDIR /evolution

FROM base AS builder

COPY ./package.json ./tsconfig.json ./

RUN npm install
Expand All @@ -17,7 +19,7 @@ COPY ./src ./src
COPY ./public ./public
COPY ./prisma ./prisma
COPY ./manager ./manager
COPY ./.env.example ./.env
#COPY ./.env.example ./.env
COPY ./runWithProvider.js ./
COPY ./tsup.config.ts ./

Expand All @@ -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" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): ENTRYPOINT with bash -c can complicate signal handling.

This approach may prevent signals like SIGTERM from reaching the Node.js process, impacting graceful shutdown. Consider running the Node.js process directly for better signal handling.

Suggested change
ENTRYPOINT ["/bin/bash", "-c", "npm run dev:server" ]
ENTRYPOINT ["npm", "run", "dev:server"]


FROM node:20-alpine AS final

RUN apk update && \
Expand All @@ -46,7 +59,7 @@ 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/.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
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
20 changes: 20 additions & 0 deletions docker-compose.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: "3.7"
services:
api:
build:
context: .
dockerfile: Dockerfile
target: final
restart: always
volumes:
- evolution_instances:/evolution/instances
networks:
- Docker

volumes:
evolution_instances:

networks:
Docker: ## Nome da rede interna
external: true
name: Docker ## Nome da rede interna
26 changes: 14 additions & 12 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
version: "3.7"
services:
api:
build:
context: .
dockerfile: Dockerfile
target: final
container_name: evolution_api
image: evoapicloud/evolution-api:latest
restart: always
depends_on:
- redis
Expand All @@ -11,16 +15,14 @@ services:
volumes:
- evolution_instances:/evolution/instances
networks:
- evolution-net
env_file:
- .env
- Docker
expose:
- 8080

redis:
image: redis:latest
networks:
- evolution-net
- Docker
container_name: redis
command: >
redis-server --port 6379 --appendonly yes
Expand All @@ -33,14 +35,14 @@ services:
container_name: postgres
image: postgres:15
networks:
- evolution-net
command: ["postgres", "-c", "max_connections=1000", "-c", "listen_addresses=*"]
- Docker
#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:
Expand All @@ -55,6 +57,6 @@ volumes:


networks:
evolution-net:
name: evolution-net
driver: bridge
Docker: ## Nome da rede interna
external: true
name: Docker ## Nome da rede interna
Loading