Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
fix: set correct Dockerfile user workdir defaults (#941)
Jakub Dobryf12291272d7e
diff --git a/.changeset/tiny-lies-wink.md b/.changeset/tiny-lies-wink.mdnew file mode 100644index 000000000..7937afda8--- /dev/null+++ b/.changeset/tiny-lies-wink.md@@ -0,0 +1,7 @@+---+'@e2b/python-sdk': patch+'e2b': patch+'@e2b/cli': patch+---++set correct Docker user workdir defaultsdiff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_dev.pyindex 64fd36d11..618269951 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_dev.py@@ -12,4 +12,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_prod.pyindex 89c6fbe6d..0ca197506 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_prod.py@@ -12,4 +12,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/template.py b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/template.pyindex 71338e310..591347a9c 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/template.py+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/template.py@@ -3,6 +3,8 @@ from e2b import AsyncTemplatetemplate = (AsyncTemplate().from_image("python:3.11-slim")+ .set_user("root")+ .set_workdir("/").run_cmd("apt-get update && apt-get install -y gcc g++ make libpq-dev && rm -rf /var/lib/apt/lists/*").set_envs({"PYTHONDONTWRITEBYTECODE": "1",diff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_dev.pyindex 690070721..a2862153c 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_dev.py@@ -7,4 +7,4 @@ if __name__ == "__main__":template,alias="complex-python-app-dev",on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_prod.pyindex c24b743f1..56bc070ca 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_prod.py@@ -7,4 +7,4 @@ if __name__ == "__main__":template,alias="complex-python-app",on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/template.py b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/template.pyindex 94a28b5b4..11388c0a0 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/template.py+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/template.py@@ -3,6 +3,8 @@ from e2b import Templatetemplate = (Template().from_image("python:3.11-slim")+ .set_user("root")+ .set_workdir("/").run_cmd("apt-get update && apt-get install -y gcc g++ make libpq-dev && rm -rf /var/lib/apt/lists/*").set_envs({"PYTHONDONTWRITEBYTECODE": "1",diff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.dev.tsindex ab0970e38..6ee102d29 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.dev.ts@@ -8,4 +8,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.prod.tsindex f5d7df411..9989c4544 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.prod.ts@@ -8,4 +8,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/template.ts b/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/template.tsindex 1bd1927dd..9d116ace4 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/template.ts+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/template.ts@@ -2,6 +2,8 @@ import { Template } from 'e2b'export const template = Template().fromImage('python:3.11-slim')+ .setUser('root')+ .setWorkdir('/').runCmd('apt-get update && apt-get install -y gcc g++ make libpq-dev && rm -rf /var/lib/apt/lists/*').setEnvs({'PYTHONDONTWRITEBYTECODE': '1',@@ -15,4 +17,4 @@ export const template = Template().setUser('appuser').setUser('root').setWorkdir('/home/user')- .setStartCmd('gunicorn --bind 0.0.0.0:8000 app:application', 'sleep 20')+ .setStartCmd('gunicorn --bind 0.0.0.0:8000 app:application', 'sleep 20')\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_dev.pyindex 4f84e88b3..900ec5f67 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_dev.py@@ -12,4 +12,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_prod.pyindex c9623f9f7..677ef1332 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_prod.py@@ -12,4 +12,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/template.py b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/template.pyindex 61e8fc604..be38cc4f1 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/template.py+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/template.py@@ -3,6 +3,8 @@ from e2b import AsyncTemplatetemplate = (AsyncTemplate().from_image("alpine:latest")+ .set_user("root")+ .set_workdir("/").copy("package.json", "/app/").copy("src/index.js", "./src/").copy("config.json", "/etc/app/config.json")diff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_dev.pyindex bfa5130c4..a16d67817 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_dev.py@@ -7,4 +7,4 @@ if __name__ == "__main__":template,alias="copy-test-dev",on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_prod.pyindex d7e50a8e4..05d447e33 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_prod.py@@ -7,4 +7,4 @@ if __name__ == "__main__":template,alias="copy-test",on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/template.py b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/template.pyindex 83a3694c3..d577098ea 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/template.py+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/template.py@@ -3,6 +3,8 @@ from e2b import Templatetemplate = (Template().from_image("alpine:latest")+ .set_user("root")+ .set_workdir("/").copy("package.json", "/app/").copy("src/index.js", "./src/").copy("config.json", "/etc/app/config.json")diff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.dev.tsindex e1322523a..6cc5a2f7b 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.dev.ts@@ -8,4 +8,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.prod.tsindex ea6273eef..57d99a181 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.prod.ts@@ -8,4 +8,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/template.ts b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/template.tsindex a4fffac47..91cea36ad 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/template.ts+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/template.ts@@ -2,6 +2,8 @@ import { Template } from 'e2b'export const template = Template().fromImage('alpine:latest')+ .setUser('root')+ .setWorkdir('/').copy('package.json', '/app/').copy('src/index.js', './src/')- .copy('config.json', '/etc/app/config.json')+ .copy('config.json', '/etc/app/config.json')\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_dev.pyindex 99799c049..9cff4ef28 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_dev.py@@ -12,4 +12,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_prod.pyindex 8172c99da..3d996a97d 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_prod.py@@ -12,4 +12,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/template.py b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/template.pyindex 3146ae513..8d06c8e83 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/template.py+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/template.py@@ -3,6 +3,8 @@ from e2b import AsyncTemplatetemplate = (AsyncTemplate().from_image("node:18")+ .set_user("root")+ .set_workdir("/").set_workdir("/app").copy("server.js", ".").set_user("root")diff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_dev.pyindex eff404af6..7c84ccb90 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_dev.py@@ -7,4 +7,4 @@ if __name__ == "__main__":template,alias="custom-app-dev",on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_prod.pyindex 207bf3283..f4195c083 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_prod.py@@ -7,4 +7,4 @@ if __name__ == "__main__":template,alias="custom-app",on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/template.py b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/template.pyindex 4ce6a52d4..cace62b03 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/template.py+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/template.py@@ -3,6 +3,8 @@ from e2b import Templatetemplate = (Template().from_image("node:18")+ .set_user("root")+ .set_workdir("/").set_workdir("/app").copy("server.js", ".").set_user("root")diff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.dev.tsindex 745ab073b..5eab3397b 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.dev.ts@@ -8,4 +8,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.prod.tsindex e40611794..4f3085568 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.prod.ts@@ -8,4 +8,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/template.ts b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/template.tsindex cccc51f8b..2fcd22b27 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/template.ts+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/template.ts@@ -2,8 +2,10 @@ import { Template } from 'e2b'export const template = Template().fromImage('node:18')+ .setUser('root')+ .setWorkdir('/').setWorkdir('/app').copy('server.js', '.').setUser('root').setWorkdir('/home/user')- .setStartCmd('node server.js', 'curl -f http://localhost:3000/health || exit 1')+ .setStartCmd('node server.js', 'curl -f http://localhost:3000/health || exit 1')\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_dev.pyindex c08181d51..20c9b044d 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_dev.py@@ -12,4 +12,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_prod.pyindex e3b2c97e4..14386413a 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_prod.py@@ -12,4 +12,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/template.py b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/template.pyindex 46dc7734c..e87b61a01 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/template.py+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/template.py@@ -3,4 +3,6 @@ from e2b import AsyncTemplatetemplate = (AsyncTemplate().from_image("ubuntu:latest")-)+ .set_user("root")+ .set_workdir("/")+)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_dev.pyindex 2d71c1c19..58241df23 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_dev.py@@ -7,4 +7,4 @@ if __name__ == "__main__":template,alias="minimal-template-dev",on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_prod.pyindex 0e79d75d4..39ce1a568 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_prod.py@@ -7,4 +7,4 @@ if __name__ == "__main__":template,alias="minimal-template",on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/template.py b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/template.pyindex d8845e053..fa222a559 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/template.py+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/template.py@@ -3,4 +3,6 @@ from e2b import Templatetemplate = (Template().from_image("ubuntu:latest")-)+ .set_user("root")+ .set_workdir("/")+)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.dev.tsindex 8c4f9cc33..cfba1c003 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.dev.ts@@ -8,4 +8,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.prod.tsindex 758d9dce0..4c6eacaf3 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.prod.ts@@ -8,4 +8,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/template.ts b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/template.tsindex fa4fa0d98..11fabe948 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/template.ts+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/template.ts@@ -2,3 +2,5 @@ import { Template } from 'e2b'export const template = Template().fromImage('ubuntu:latest')+ .setUser('root')+ .setWorkdir('/')\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_dev.pyindex 33af3d7d2..8d71582d8 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_dev.py@@ -12,4 +12,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_prod.pyindex ebe798da7..2926f9fab 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_prod.py@@ -12,4 +12,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/template.py b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/template.pyindex 9849311f0..9edefaa7f 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/template.py+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/template.py@@ -3,4 +3,4 @@ from e2b import AsyncTemplatetemplate = (AsyncTemplate().from_image("my-custom-image")-)+)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_dev.pyindex 59fffa7d9..ec17a4ac5 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_dev.py@@ -7,4 +7,4 @@ if __name__ == "__main__":template,alias="multi-stage-dev",on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_prod.pyindex fc53b3003..8491ec32c 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_prod.py@@ -7,4 +7,4 @@ if __name__ == "__main__":template,alias="multi-stage",on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/template.py b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/template.pyindex c1efd3d69..ce79dd098 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/template.py+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/template.py@@ -3,4 +3,4 @@ from e2b import Templatetemplate = (Template().from_image("my-custom-image")-)+)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.dev.tsindex 0fdecd176..7992e5d0f 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.dev.ts@@ -8,4 +8,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.prod.tsindex 8dd3e5781..133492953 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.prod.ts@@ -8,4 +8,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/template.ts b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/template.tsindex 6df1999cb..c69e38b68 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/template.ts+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/template.ts@@ -1,4 +1,4 @@import { Template } from 'e2b'export const template = Template()- .fromImage('my-custom-image')+ .fromImage('my-custom-image')\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_dev.pyindex 3cb18ece4..3fb69fa7d 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_dev.py@@ -12,4 +12,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_prod.pyindex 37cd47d06..c1f15eaa5 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_prod.py@@ -12,4 +12,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/template.py b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/template.pyindex beb147852..334bc86c7 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/template.py+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/template.py@@ -3,6 +3,8 @@ from e2b import AsyncTemplatetemplate = (AsyncTemplate().from_image("node:18")+ .set_user("root")+ .set_workdir("/").set_envs({"NODE_ENV": "production",})diff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_dev.pyindex 63301bafd..e53859b94 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_dev.py@@ -7,4 +7,4 @@ if __name__ == "__main__":template,alias="env-test-dev",on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_prod.pyindex 621445029..aa968c267 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_prod.py@@ -7,4 +7,4 @@ if __name__ == "__main__":template,alias="env-test",on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/template.py b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/template.pyindex 068644bb4..d6d01c9f3 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/template.py+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/template.py@@ -3,6 +3,8 @@ from e2b import Templatetemplate = (Template().from_image("node:18")+ .set_user("root")+ .set_workdir("/").set_envs({"NODE_ENV": "production",})diff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.dev.tsindex 10c0e292e..2fab51c19 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.dev.ts@@ -8,4 +8,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.prod.tsindex df7f44057..f2e148103 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.prod.ts@@ -8,4 +8,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/template.ts b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/template.tsindex 225074837..e5cdb0d5d 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/template.ts+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/template.ts@@ -2,6 +2,8 @@ import { Template } from 'e2b'export const template = Template().fromImage('node:18')+ .setUser('root')+ .setWorkdir('/').setEnvs({'NODE_ENV': 'production',})@@ -16,4 +18,4 @@ export const template = Template().setEnvs({'SINGLE_VAR': 'single_value',})- .setWorkdir('/app')+ .setWorkdir('/app')\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_dev.pyindex c0cd96d96..4cc63b473 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_dev.py@@ -14,4 +14,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_prod.pyindex 8da80c6e4..619683495 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_prod.py@@ -14,4 +14,4 @@ async def main():if __name__ == "__main__":- asyncio.run(main())+ asyncio.run(main())\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/template.py b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/template.pyindex dcae70878..a42286b40 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/template.py+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/template.py@@ -3,6 +3,8 @@ from e2b import AsyncTemplatetemplate = (AsyncTemplate().from_image("python:3.11")+ .set_user("root")+ .set_workdir("/").set_workdir("/app").run_cmd("pip install --upgrade pip").run_cmd("pip install -r requirements.txt")@@ -12,4 +14,4 @@ template = (.set_user("root").set_workdir("/home/user").set_start_cmd("node server.js", "sleep 20")-)+)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_dev.pyindex 2241a6c2d..7c81d9b2b 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_dev.py@@ -9,4 +9,4 @@ if __name__ == "__main__":cpu_count=2,memory_mb=1024,on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_prod.pyindex 8fd2e2ad7..41c44139a 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_prod.py@@ -9,4 +9,4 @@ if __name__ == "__main__":cpu_count=2,memory_mb=1024,on_build_logs=default_build_logger(),- )+ )\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/template.py b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/template.pyindex ba2f46083..5c8fb54db 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/template.py+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/template.py@@ -3,6 +3,8 @@ from e2b import Templatetemplate = (Template().from_image("python:3.11")+ .set_user("root")+ .set_workdir("/").set_workdir("/app").run_cmd("pip install --upgrade pip").run_cmd("pip install -r requirements.txt")@@ -12,4 +14,4 @@ template = (.set_user("root").set_workdir("/home/user").set_start_cmd("node server.js", "sleep 20")-)+)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.dev.tsindex 5872ff5ff..8c13375f4 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.dev.ts@@ -10,4 +10,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.prod.tsindex ed353067a..74677ba71 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.prod.ts@@ -10,4 +10,4 @@ async function main() {});}-main().catch(console.error);+main().catch(console.error);\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/template.ts b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/template.tsindex 9e2dc7c90..3c298c427 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/template.ts+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/template.ts@@ -2,6 +2,8 @@ import { Template } from 'e2b'export const template = Template().fromImage('python:3.11')+ .setUser('root')+ .setWorkdir('/').setWorkdir('/app').runCmd('pip install --upgrade pip').runCmd('pip install -r requirements.txt')@@ -10,4 +12,4 @@ export const template = Template()}).setUser('root').setWorkdir('/home/user')- .setStartCmd('node server.js', 'sleep 20')+ .setStartCmd('node server.js', 'sleep 20')\ No newline at end of filediff --git a/packages/js-sdk/src/template/dockerfileParser.ts b/packages/js-sdk/src/template/dockerfileParser.tsindex 551f5e3ae..ccf64eb29 100644--- a/packages/js-sdk/src/template/dockerfileParser.ts+++ b/packages/js-sdk/src/template/dockerfileParser.ts@@ -1,4 +1,4 @@-import { CopyItem, Instruction } from './types'+import { CopyItem } from './types'import {Argument,DockerfileParser,@@ -9,7 +9,6 @@ import { ReadyCmd, waitForTimeout } from './readycmd'export interface DockerfileParseResult {baseImage: string- instructions: Instruction[]}interface DockerfileFinalParserInterface {}@@ -91,7 +90,9 @@ export function parseDockerfile(baseImage = argumentsData[0].getValue()}- const resultInstructions: Instruction[] = []+ // Set the user and workdir to the Docker defaults+ templateBuilder.setUser('root')+ templateBuilder.setWorkdir('/')// Process all other instructionsfor (const instruction of instructions) {@@ -145,7 +146,6 @@ export function parseDockerfile(return {baseImage,- instructions: resultInstructions,}}diff --git a/packages/python-sdk/e2b/template/dockerfile_parser.py b/packages/python-sdk/e2b/template/dockerfile_parser.pyindex 558bdadbf..c1d27be0d 100644--- a/packages/python-sdk/e2b/template/dockerfile_parser.py+++ b/packages/python-sdk/e2b/template/dockerfile_parser.py@@ -104,6 +104,10 @@ def parse_dockerfile(if " as " in base_image.lower():base_image = base_image.split(" as ")[0].strip()+ # Set the user and workdir to the Docker defaults+ template_builder.set_user("root")+ template_builder.set_workdir("/")+# Process all other instructionsfor instruction_data in dfp.structure:instruction = instruction_data["instruction"]