Skip to content

Commit 3a20078

Browse files
authored
Add Pynecone Container Image Build - Documentation from r0b2g1t/main
Add Pynecone Container Image Build - Documentation
2 parents 971700b + 575977d commit 3a20078

File tree

1 file changed

+66
-3
lines changed

1 file changed

+66
-3
lines changed

pcweb/pages/docs/hosting/self_hosting.py

+66-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def self_hosting():
3838
doctext(
3939
"Clone your code to a server and install the ",
4040
doclink("requirements", href=installation.path),
41-
". ",
41+
".",
4242
),
4343
subheader("Edit Config"),
4444
doctext(
@@ -49,7 +49,7 @@ def self_hosting():
4949
" at the end.",
5050
),
5151
doctext(
52-
"For example if your server is at 192.168.1.1, your config would look like this: "
52+
"For example if your server is at 192.168.1.1, your config would look like this:"
5353
),
5454
doccode(
5555
"""config = pc.Config(
@@ -60,7 +60,7 @@ def self_hosting():
6060
)
6161
""",
6262
),
63-
doctext("Then run your app in production mode: "),
63+
doctext("Then run your app in production mode:"),
6464
doccode("$ pc run --env prod", language="bash"),
6565
doctext(
6666
" Production mode creates an optimized build of your app.",
@@ -93,4 +93,67 @@ def self_hosting():
9393
pc.code("--backend-only"),
9494
" flags.",
9595
),
96+
subheader("Pynecone Container Service"),
97+
doctext(
98+
"Another option is to run your Pynecone service in a container.",
99+
"For this purpose, a ",
100+
pc.code("Dockerfile"),
101+
" and additional documentation is available in the Pynecone project in the directory ",
102+
pc.code("docker-example"),
103+
". ",
104+
),
105+
doctext(
106+
"For the build of the container image it is necessary to edit the ",
107+
pc.code("pcconfig.py"),
108+
" and the add the ",
109+
pc.code("requirements.txt"),
110+
" to your project folder. The following changes are necessary in ",
111+
pc.code("pcconfig.py"),
112+
":",
113+
),
114+
doccode(
115+
"""config = pc.Config(
116+
app_name="app",
117+
api_url="0.0.0.0:8000",
118+
bun_path="/app/.bun/bin/bun",
119+
db_url="sqlite:///pynecone.db",
120+
)
121+
""",
122+
),
123+
doctext(
124+
"You can find the ",
125+
pc.code("requirements.txt"),
126+
" in the ",
127+
pc.code("docker-example"),
128+
" folder of the project too."
129+
),
130+
doctext(
131+
"The project structure should looks like this:",
132+
),
133+
doccode(
134+
"""hello
135+
├── .web
136+
├── assets
137+
├── hello
138+
│ ├── __init__.py
139+
│ └── hello.py
140+
├── pcconfig.py
141+
├── Dockerfile
142+
└── requirements.txt""",
143+
language="bash",
144+
),
145+
doctext(
146+
"After all changes have been made, the container image can now be created as follows.",
147+
),
148+
doccode(
149+
"""$ docker build -t pynecone-project:latest .""",
150+
language="bash",
151+
),
152+
doctext(
153+
"Finally, you can start your Pynecone container service as follows.",
154+
),
155+
doccode(
156+
"""$ docker run -d -p 3000:3000 -p 8000:8000 --name pynecone pynecone:latest""",
157+
language="bash",
158+
),
96159
)

0 commit comments

Comments
 (0)