Newer
Older
nextcloud / docker-compose.yml
services:
  nextcloud-app:
    #build: ./docker/app
    image: pgollor/nextcloud:app-stable
    restart: always
    depends_on:
      - nextcloud-database
      - nextcloud-redis
    environment:
      - MYSQL_HOST=mysql
      - MYSQL_DATABASE=cloud
      - MYSQL_USER=cloud
      - MYSQL_PASSWORD=${NEXTCLOUD_DATABASE_PASSWORD}
      - NEXTCLOUD_ADMIN_USER=${NEXTCLOUD_ADMIN_USER}
      - NEXTCLOUD_ADMIN_PASSWORD=${NEXTCLOUD_ADMIN_PASSWORD}
      - NEXTCLOUD_DATA_DIR=/srv/data
      - REDIS_HOST=redis
      - TZ=${TZ}
    tmpfs:
      - /tmp
    volumes:
      - ./data/app:/var/www/html
      - ./data/data:/srv/data
    networks:
      nextcloud-network:
        ipv4_address: ${NEXTCLOUD_IPV4_NETWORK:-172.22.5}.100
        aliases:
          - app

  nextcloud-web:
    #build: ./docker/web
    image: pgollor/nextcloud:web-latest
    restart: always
    logging:
      driver: json-file
    ports:
      - "${NEXTCLOUD_WEB_BIND:-127.0.0.1}:${NEXTCLOUD_WEB_PORT:-8080}:80"
    volumes:
      - ./data/app:/var/www/html:ro
    depends_on:
      - nextcloud-app
    networks:
      nextcloud-network:
        ipv4_address: ${NEXTCLOUD_IPV4_NETWORK:-172.22.5}.101
        aliases:
          - web

  nextcloud-database:
    image: mariadb:10.6
    restart: always
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    environment:
      - MYSQL_ROOT_PASSWORD=${NEXTCLOUD_DATABASE_ROOT}
      - MYSQL_DATABASE=cloud
      - MYSQL_USER=cloud
      - MYSQL_PASSWORD=${NEXTCLOUD_DATABASE_PASSWORD}
    volumes:
      -  nextcloud-db-vol-1:/var/lib/mysql/
      - ./data/conf/mysql:/etc/mysql/conf.d/:ro
    tmpfs:
      - /tmp
    networks:
      nextcloud-network:
        ipv4_address: ${NEXTCLOUD_IPV4_NETWORK:-172.22.5}.102
        aliases:
          - mysql

  nextcloud-redis:
    image: redis:alpine
    restart: always
    networks:
      nextcloud-network:
        aliases:
          - redis

  nextcloud-cron:
    #build: ./docker/app
    image: pgollor/nextcloud:app-stable
    restart: always
    volumes:
      - ./data/app:/var/www/html
      - ./data/data:/srv/data
    logging:
      driver: json-file
    entrypoint: /cron.sh
    depends_on:
      - nextcloud-database
      - nextcloud-redis
    networks:
      nextcloud-network:

networks:
  nextcloud-network:
    driver: bridge
    enable_ipv6: false
    ipam:
      driver: default
      config:
        - subnet: ${NEXTCLOUD_IPV4_NETWORK:-172.22.5}.0/24

volumes:
  nextcloud-db-vol-1: