Here's what I did: - Added `container_name` for `api` and `ui` services in `docker-compose.yml`. - Created `ui/src/apiClient.js` to configure the API base URL using the API container name (`http://planilla-api:4000/api`). - Added `axios` as a dependency to the UI project. - Ensured UI store files correctly import the new `apiClient.js`. This will allow your UI to reliably connect to the API service using Docker's internal DNS resolution via container names.
74 lines
1.6 KiB
YAML
74 lines
1.6 KiB
YAML
version: "3.8"
|
|
|
|
services:
|
|
agent:
|
|
image: gitea.interno.com/nucleo000/planilla-agent:latest
|
|
build: ./agent
|
|
restart: unless-stopped
|
|
networks: [planilla]
|
|
|
|
api:
|
|
container_name: planilla-api
|
|
image: gitea.interno.com/nucleo000/planilla-api:latest
|
|
build: ./api
|
|
restart: unless-stopped
|
|
environment:
|
|
DATABASE_URL: "postgresql://planilla:secret@db:5432/planilla_db?schema=public"
|
|
depends_on:
|
|
- db
|
|
ports:
|
|
- "3009:4000"
|
|
networks: [planilla, principal]
|
|
|
|
ui:
|
|
container_name: planilla-ui
|
|
image: gitea.interno.com/nucleo000/planilla-ui:latest
|
|
build: ./ui
|
|
restart: unless-stopped
|
|
ports:
|
|
- "3008:80"
|
|
networks: [planilla, principal]
|
|
|
|
worker:
|
|
image: gitea.interno.com/nucleo000/planilla-worker:latest
|
|
build: ./worker
|
|
restart: unless-stopped
|
|
environment:
|
|
DATABASE_URL: "postgresql://planilla:secret@db:5432/planilla_db?schema=public"
|
|
depends_on:
|
|
- db
|
|
networks: [planilla]
|
|
|
|
db:
|
|
image: postgres:16
|
|
environment:
|
|
POSTGRES_DB: planilla_db
|
|
POSTGRES_USER: planilla
|
|
POSTGRES_PASSWORD: secret
|
|
volumes:
|
|
- /srv/planilla/db:/var/lib/postgresql/data
|
|
networks: [planilla]
|
|
|
|
pgadmin:
|
|
image: dpage/pgadmin4
|
|
environment:
|
|
PGADMIN_DEFAULT_EMAIL: planilla@planilla.com
|
|
PGADMIN_DEFAULT_PASSWORD: planilla
|
|
ports:
|
|
- "5050:80"
|
|
depends_on:
|
|
- db
|
|
volumes:
|
|
- /srv/planilla/pgadmin:/var/lib/pgadmin
|
|
user: "5050:5050"
|
|
networks: [planilla]
|
|
|
|
volumes:
|
|
db_data:
|
|
|
|
networks:
|
|
planilla:
|
|
principal:
|
|
external: true
|
|
|