# AIAss Docker Setup

This document explains how to run the AIAss gRPC service using Docker.

## Prerequisites

- Docker Desktop installed and running
- Docker Compose (usually comes with Docker Desktop)

## Quick Start

### Using Docker Compose (Recommended)

1. Navigate to the AIAss project directory:
   ```bash
   cd Presentation/AIAss
   ```

2. Build and run the service:
   ```bash
   docker-compose up --build
   ```

3. The service will be available at:
   - HTTP: http://localhost:5000
   - HTTPS: https://localhost:5001

### Using Docker directly

1. Build the Docker image:
   ```bash
   docker build -t aiass .
   ```

2. Run the container:
   ```bash
   docker run -p 5000:80 -p 5001:443 aiass
   ```

## Configuration

### Environment Variables

- `ASPNETCORE_ENVIRONMENT`: Set to `Development` or `Production`
- `ASPNETCORE_URLS`: Configure the URLs the service listens on

### Ports

- Port 80: HTTP endpoint
- Port 443: HTTPS endpoint

## Development

### Hot Reload

For development with hot reload, you can mount the source code:

```yaml
volumes:
  - .:/src
  - /src/bin
  - /src/obj
```

### Debugging

To debug the containerized application, you can:

1. Attach a debugger to the running container
2. Use remote debugging tools
3. Check logs: `docker-compose logs aiass`

## Production

For production deployment:

1. Set `ASPNETCORE_ENVIRONMENT=Production`
2. Use proper SSL certificates
3. Configure health checks
4. Set up monitoring and logging

## Troubleshooting

### Common Issues

1. **Port already in use**: Change the port mappings in docker-compose.yml
2. **Build failures**: Ensure all dependencies are properly restored
3. **Permission issues**: Check file ownership and Docker user settings

### Logs

View container logs:
```bash
docker-compose logs -f aiass
```

### Cleanup

Remove containers and images:
```bash
docker-compose down
docker system prune -a
```

## Security Notes

- The container runs as a non-root user (`appuser`)
- Only necessary ports are exposed
- Environment variables can be overridden for different deployment scenarios

