feat: switch container user to root and add welcome bootstrap for dev environment
- Change container user from 'ubuntu' to 'root' in Dockerfile and docker-compose config - Set working directory to /home/retoor/projects/snek and inject SNEK_UID environment variable - Add root password setup and copy terminal bootstrap files (entry script, .welcome.txt) into container image - Refactor compose exec/start methods to capture stdout/stderr via pipes and handle empty output gracefully - Remove strict returncode check in exec method, replacing with debug print for non-zero exits
This commit is contained in:
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import pathlib
|
||||
|
||||
import os
|
||||
|
||||
os.chdir("/root")
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||
sys.path.insert(0, "/root/bin")
|
||||
sys.path.insert(0, "/root/bin/local/bin")
|
||||
|
||||
if not pathlib.Path(".welcome.txt").exists():
|
||||
os.system("python3 -m venv --prompt '' .venv")
|
||||
os.system("cp -r /opt/bootstrap/root/.* /root")
|
||||
os.system("cp /opt/bootstrap/.welcome.txt /root/.welcome.txt")
|
||||
pathlib.Path(".bashrc").write_text(pathlib.Path(".bashrc").read_text() + "\n" + "source .venv/bin/activate")
|
||||
os.environ["SNEK"] = "1"
|
||||
|
||||
if pathlib.Path(".welcome.txt").exists():
|
||||
with open(".welcome.txt") as f:
|
||||
print(f.read())
|
||||
|
||||
os.system("bash")
|
||||
Reference in New Issue
Block a user