version: '3.2' services: db: image: postgres restart: always volumes: - db:/var/lib/postgresql/data environment: - POSTGRES_DB_FILE=/run/secrets/postgres_db - POSTGRES_USER_FILE=/run/secrets/postgres_user - POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password secrets: - postgres_db - postgres_password - postgres_user app: image: nextcloud restart: always ports: - 8080:80 volumes: - nextcloud:/var/www/html environment: - POSTGRES_HOST=db - POSTGRES_DB_FILE=/run/secrets/postgres_db - POSTGRES_USER_FILE=/run/secrets/postgres_user - POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password - NEXTCLOUD_ADMIN_PASSWORD_FILE=/run/secrets/nextcloud_admin_password - NEXTCLOUD_ADMIN_USER_FILE=/run/secrets/nextcloud_admin_user depends_on: - db secrets: - nextcloud_admin_password - nextcloud_admin_user - postgres_db - postgres_password - postgres_user volumes: db: nextcloud: secrets: nextcloud_admin_password: file: ./nextcloud_admin_password.txt # put admin password in this file nextcloud_admin_user: file: ./nextcloud_admin_user.txt # put admin username in this file postgres_db: file: ./postgres_db.txt # put postgresql db name in this file postgres_password: file: ./postgres_password.txt # put postgresql password in this file postgres_user: file: ./postgres_user.txt # put postgresql username in this file