mirror of
https://github.com/Mailu/Mailu.git
synced 2025-01-18 03:21:36 +02:00
Move docker related features to a separate module
This commit is contained in:
parent
4246179b88
commit
bbf71b262e
@ -51,9 +51,6 @@ scheduler = background.BackgroundScheduler()
|
||||
manager = flask_script.Manager(app)
|
||||
manager.add_command('db', flask_migrate.MigrateCommand)
|
||||
|
||||
# Connect to the Docker socket
|
||||
dockercli = docker.Client(base_url=app.config['DOCKER_SOCKET'])
|
||||
|
||||
# Task scheduling
|
||||
if not app.debug or os.environ.get('WERKZEUG_RUN_MAIN') == 'true':
|
||||
scheduler.start()
|
||||
|
@ -34,15 +34,8 @@ def logout():
|
||||
@app.route('/services', methods=['GET'])
|
||||
@access.global_admin
|
||||
def services():
|
||||
containers = {}
|
||||
try:
|
||||
all_containers = dockercli.containers(all=True)
|
||||
containers = dockercli.get()
|
||||
except Exception as error:
|
||||
return flask.render_template('docker-error.html', error=error)
|
||||
for brief in all_containers:
|
||||
if brief['Image'].startswith('mailu/'):
|
||||
container = dockercli.inspect_container(brief['Id'])
|
||||
container['Image'] = dockercli.inspect_image(container['Image'])
|
||||
name = container['Config']['Labels']['com.docker.compose.service']
|
||||
containers[name] = container
|
||||
return flask.render_template('services.html', containers=containers)
|
||||
|
Loading…
x
Reference in New Issue
Block a user