Skip to content
Merged
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
8 changes: 4 additions & 4 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# Build images defined in docker-compose (backend + frontend)
- name: Build containers
run: docker compose -f docker-compose.yml build
# Build test image for backend
- name: Build test container
run: docker compose -f docker-compose.yml build nestjs-test

# Start only infra services
- name: Start Postgres and Redis
Expand All @@ -51,7 +51,7 @@ jobs:

# Run NestJS tests
- name: Run NestJS tests
run: docker compose -f docker-compose.yml run --rm nestjs yarn test
run: docker compose -f docker-compose.yml run --rm nestjs-test npm test

- name: Cleanup
if: always()
Expand Down
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
services:
# Servicio para tests (CI/CD)
nestjs-test:
build:
context: ./backend
dockerfile: Dockerfile
target: test
environment:
DB_HOST: postgres
DB_PORT: "5432"
DB_NAME: "${DB_NAME}"
DB_USER: "${DB_USER}"
DB_PASSWORD: "${DB_PASSWORD}"
JWT_SECRET: "${JWT_SECRET}"
REDIS_HOST: redis
REDIS_PORT: "6379"
depends_on:
- postgres
- redis
networks:
- my_network

nestjs:
build:
context: ./backend
dockerfile: Dockerfile
target: production
restart: unless-stopped
ports:
- "3001:3000"
Expand Down