diff --git a/docker-compose.yml b/docker-compose.yml index 78ecbe2..fdecb5e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,7 @@ services: build: context: . dockerfile: Dockerfile + entrypoint: ./docker/entrypoint.sh networks: - backend - payment-processor @@ -13,13 +14,13 @@ services: depends_on: - redis - database - deploy: - resources: - limits: - cpus: "0.15" - memory: "80MB" + # deploy: + # resources: + # limits: + # cpus: "0.15" + # memory: "80MB" healthcheck: - test: [ "CMD", "curl", "-f", "http://localhost:9999" ] + test: [ "CMD", "curl", "-f", "http://api1:9999" ] interval: 30s timeout: 10s retries: 3 @@ -30,6 +31,7 @@ services: build: context: . dockerfile: Dockerfile + entrypoint: ./docker/entrypoint.sh depends_on: - redis - database @@ -38,13 +40,13 @@ services: - payment-processor volumes: - .:/app - deploy: - resources: - limits: - cpus: "0.15" - memory: "80MB" + # deploy: + # resources: + # limits: + # cpus: "0.15" + # memory: "80MB" healthcheck: - test: [ "CMD", "curl", "-f", "http://localhost:9999" ] + test: [ "CMD", "curl", "-f", "http://api2:9999" ] interval: 30s timeout: 10s retries: 3 @@ -54,7 +56,7 @@ services: container_name: nginx hostname: nginx ports: - - "9999:80" + - "9999:9999" volumes: - ./nginx.conf:/etc/nginx/nginx.conf networks: @@ -76,6 +78,8 @@ services: - "6379:6379" networks: - backend + volumes: + - redis_data:/data deploy: resources: limits: @@ -89,7 +93,7 @@ services: ports: - "5432:5432" healthcheck: - test: [ "CMD-SHELL", "pg_isready -U rinha -d rinha" ] + test: [ "CMD-SHELL", "pg_isready -U postgres -d payment" ] interval: 5s timeout: 5s retries: 5 @@ -115,4 +119,5 @@ networks: external: true volumes: - database_volume: \ No newline at end of file + database_volume: + redis_data: diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..243b211 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh +yarn start:dev + diff --git a/local.Dockerfile b/local.Dockerfile index 438b542..4340f7c 100644 --- a/local.Dockerfile +++ b/local.Dockerfile @@ -6,4 +6,4 @@ COPY . . RUN yarn install -y \ && yarn build -ENTRYPOINT [ "yarn", "start:dev" ] \ No newline at end of file +EXPOSE 9999