18 lines
1.1 KiB
Python
18 lines
1.1 KiB
Python
"""Run as root on Athena. Only creates the explicit optional LadyPoly UI."""
|
|
import os, socket, subprocess
|
|
from pathlib import Path
|
|
base=Path('/opt/athena-ladypoly/data');name='athena-ladypoly';image='athena-ladypoly:3960afc-deck1'
|
|
if subprocess.run(['docker','inspect',name],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL).returncode==0:
|
|
raise SystemExit('LadyPoly container already exists; no automatic replacement.')
|
|
with socket.socket() as s:
|
|
s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
|
|
s.bind(('127.0.0.1',8127))
|
|
base.mkdir(parents=True,exist_ok=True);os.chown(base,65534,65534);base.chmod(0o700)
|
|
subprocess.check_call(['docker','run','-d','--name',name,'--network','host','--restart','unless-stopped','--read-only',
|
|
'--cap-drop','ALL','--security-opt','no-new-privileges:true','--memory','1g','--cpus','2',
|
|
'--tmpfs','/tmp:rw,noexec,nosuid,size=128m,uid=65534,gid=65534',
|
|
'--label','io.athena-deck.managed=true','--label','io.athena-deck.role=application',
|
|
'--label','io.athena-deck.application=ladypoly','--label','io.athena-deck.port=8127',
|
|
'-v',str(base)+':/data:rw',image])
|
|
print('LadyPoly UI: http://127.0.0.1:8127/deck-connection')
|