Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pynecone Container Image Build - Documentation #7

Merged
merged 4 commits into from
Feb 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 66 additions & 3 deletions pcweb/pages/docs/hosting/self_hosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def self_hosting():
doctext(
"Clone your code to a server and install the ",
doclink("requirements", href=installation.path),
". ",
".",
),
subheader("Edit Config"),
doctext(
Expand All @@ -49,7 +49,7 @@ def self_hosting():
" at the end.",
),
doctext(
"For example if your server is at 192.168.1.1, your config would look like this: "
"For example if your server is at 192.168.1.1, your config would look like this:"
),
doccode(
"""config = pc.Config(
Expand All @@ -60,7 +60,7 @@ def self_hosting():
)
""",
),
doctext("Then run your app in production mode: "),
doctext("Then run your app in production mode:"),
doccode("$ pc run --env prod", language="bash"),
doctext(
" Production mode creates an optimized build of your app.",
Expand Down Expand Up @@ -93,4 +93,67 @@ def self_hosting():
pc.code("--backend-only"),
" flags.",
),
subheader("Pynecone Container Service"),
doctext(
"Another option is to run your Pynecone service in a container.",
"For this purpose, a ",
pc.code("Dockerfile"),
" and additional documentation is available in the Pynecone project in the directory ",
pc.code("docker-example"),
". ",
),
doctext(
"For the build of the container image it is necessary to edit the ",
pc.code("pcconfig.py"),
" and the add the ",
pc.code("requirements.txt"),
" to your project folder. The following changes are necessary in ",
pc.code("pcconfig.py"),
":",
),
doccode(
"""config = pc.Config(
app_name="app",
api_url="0.0.0.0:8000",
bun_path="/app/.bun/bin/bun",
db_url="sqlite:///pynecone.db",
)
""",
),
doctext(
"You can find the ",
pc.code("requirements.txt"),
" in the ",
pc.code("docker-example"),
" folder of the project too."
),
doctext(
"The project structure should looks like this:",
),
doccode(
"""hello
├── .web
├── assets
├── hello
│ ├── __init__.py
│ └── hello.py
├── pcconfig.py
├── Dockerfile
└── requirements.txt""",
language="bash",
),
doctext(
"After all changes have been made, the container image can now be created as follows.",
),
doccode(
"""$ docker build -t pynecone-project:latest .""",
language="bash",
),
doctext(
"Finally, you can start your Pynecone container service as follows.",
),
doccode(
"""$ docker run -d -p 3000:3000 -p 8000:8000 --name pynecone pynecone:latest""",
language="bash",
),
)