**Purpose**: Deploy a Nextcloud and PostgreSQL database together.

```jsx title="docker-compose.yml"
version: "2.1"
services:
  app:
    image: nextcloud:apache
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.nextcloud.rule=Host(`files.bunny-lab.io`)"
      - "traefik.http.routers.nextcloud.entrypoints=websecure"
      - "traefik.http.routers.nextcloud.tls.certresolver=letsencrypt"
      - "traefik.http.services.nextcloud.loadbalancer.server.port=80"
    environment:
      - TZ=${TZ}
      - POSTGRES_DB=${POSTGRES_DB}
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_HOST=${POSTGRES_HOST}
      - OVERWRITEPROTOCOL=https
      - NEXTCLOUD_ADMIN_USER=${NEXTCLOUD_ADMIN_USER}
      - NEXTCLOUD_ADMIN_PASSWORD=${NEXTCLOUD_ADMIN_PASSWORD}
      - NEXTCLOUD_TRUSTED_DOMAINS=${NEXTCLOUD_TRUSTED_DOMAINS}
    volumes:
      - /srv/containers/nextcloud/html:/var/www/html
    ports:
      - 443:443
      - 80:80
    restart: always
    depends_on:
      - db
    networks:
        docker_network:
          ipv4_address: 192.168.5.17
  db:
      image: postgres:12-alpine
      environment:
        - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
        - POSTGRES_USER=${POSTGRES_USER}
        - POSTGRES_DB=${POSTGRES_DB}
      volumes:
        - /srv/containers/nextcloud/db:/var/lib/postgresql/data
      ports:
        - 5432:5432 
      restart: always
      networks:
        docker_network:
          ipv4_address: 192.168.5.18

networks:
  docker_network:
    external: true
```

```jsx title=".env"
TZ=America/Denver
POSTGRES_PASSWORD=SomeSecurePassword
POSTGRES_USER=ncadmin
POSTGRES_HOST=192.168.5.18
POSTGRES_DB=nextcloud
NEXTCLOUD_ADMIN_USER=admin
NEXTCLOUD_ADMIN_PASSWORD=SomeSuperSecurePassword
NEXTCLOUD_TRUSTED_DOMAINS=cloud.bunny-lab.io
```
