# Exercise — writing Dockerfiles

1. Check out the code repository:

   ```bash
   git clone https://git.verleun.org/training/docker-build-exercise.git
   ```

2. Add a `Dockerfile` that will build the image:

    * Use `python:3.9.9-slim-bullseye` as the base image (`FROM` line)

    * Expose port 8000 (`EXPOSE`)

    * Installs files in '/usr/local/app' (`WORKDIR` )

    * Execute the command `uvicorn app:api --host 0.0.0.0 --port 8000`

3. Build the image with `docker build -t exercise:1 .`

4. Run the image: `docker run -d -p 8123:8000 exercise:1`

---

## Again, with docker-compose (optional)

Create a `docker-compose.yml` with the following content:

```yaml
version: "3"
services:
  app:
    build: .
    ports:
    - 8123:8000
```

Start the container: `docker-compose up -d`
