Newer
Older
nextcloud / docker-compose.yml
version: '3'

services:
  app:
    image: pgollor/nextcloud:app-dev-latest
    build: ./docker/app
    restart: always
    cpus: 1.5
    env_file:
      - db.env
      - cloud.env
    environment:
      - MYSQL_HOST=db
      - MYSQL_DATABASE=cloud
      - MYSQL_USER=cloud
      - NEXTCLOUD_ADMIN_USER=${NEXTCLOUD_ADMIN_USER}
      - NEXTCLOUD_DATA_DIR=/srv/data
      - REDIS_HOST=redis
      - TZ=${TZ}
      - NEXTCLOUD_TRUSTED_DOMAINS=${NEXTCLOUD_TRUSTED_DOMAINS}
      - OVERWRITEHOST=${NEXTCLOUD_OVERWRITEHOST}
      - OVERWRITEPROTOCOL=https
    tmpfs:
      - /tmp
    links:
      - "database:db"
    volumes:
      - app-vol-1:/var/www/html
      - ./data/data:/srv/data
    depends_on:
      - database
      - redis

  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:
      - app-vol-1:/var/www/html:ro
    links:
      - "app:app"
    depends_on:
      - app

  database:
    image: mariadb
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    environment:
      - MYSQL_DATABASE=cloud
      - MYSQL_USER=cloud
    env_file:
      - db.env
    volumes:
      -  db-vol-1:/var/lib/mysql/
      - ./data/conf/mysql:/etc/mysql/conf.d/:ro
    tmpfs:
      - /tmp

  redis:
    image: redis:alpine
    restart: always

  cron:
    image: nextcloud:fpm-alpine
    restart: always
    volumes:
      - app-vol-1:/var/www/html
      - ./data/data:/srv/data
    logging:
      driver: json-file
    entrypoint: /cron.sh
    depends_on:
      - database
      - redis

volumes:
  db-vol-1:
  app-vol-1: