-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fe529c
commit 965dc12
Showing
9 changed files
with
130 additions
and
2 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# .github/workflows/publish-dockerhub.yml | ||
name: Publish Docker image to Docker Hub | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ github.repository_owner }}/robyn-docker:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM python:3.11-bookworm | ||
|
||
WORKDIR /workspace | ||
|
||
COPY . . | ||
|
||
RUN pip install --no-cache-dir --upgrade -r requirements.txt | ||
|
||
|
||
EXPOSE 8080 | ||
|
||
CMD ["python3", "app.py", "--log-level=DEBUG"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
# robyn-docker | ||
Robyn, a Rust based API in Python, with Docker | ||
Robyn with Docker π³π¦ | ||
Welcome to robyn-docker, a project showcasing the power of Robyn, a Rust-based asynchronous web framework, through Python. This project demonstrates how to containerize a Robyn application using Docker, making deployment smooth and scalable across any environment. | ||
|
||
Robyn brings together Rust's performance and safety with Python's simplicity and flexibility, offering an excellent choice for building high-performance web applications. | ||
|
||
π Getting Started | ||
To get started with robyn-docker, you'll need to have Python and Docker installed on your machine. The following instructions will guide you through setting up a basic Robyn project and containerizing it with Docker. | ||
|
||
Getting Started: https://robyn.tech/documentation/example_app | ||
|
||
``` | ||
$ python3 -m robyn --create | ||
? Directory Path: . | ||
? Need Docker? (Y/N) Y | ||
? Please select project type (Mongo/Postgres/Sqlalchemy/Prisma): | ||
β― No DB | ||
Sqlite | ||
Postgres | ||
MongoDB | ||
SqlAlchemy | ||
Prisma | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from robyn import Robyn | ||
import sqlite3 | ||
|
||
app = Robyn(__file__) | ||
|
||
|
||
@app.get("/") | ||
def index(): | ||
# your db name | ||
conn = sqlite3.connect("example.db") | ||
cur = conn.cursor() | ||
cur.execute("DROP TABLE IF EXISTS test") | ||
cur.execute("CREATE TABLE test(column_1, column_2)") | ||
res = cur.execute("SELECT name FROM sqlite_master") | ||
th = res.fetchone() | ||
table_name = th[0] | ||
return f"Welcome to Robyn, This is a rust based Python package utilzing the effciency of Rust with simplicity of Python. Here is an example fo the SQLtable create by default in this framework {table_name}" | ||
|
||
|
||
if __name__ == "__main__": | ||
app.start(host="0.0.0.0", port=8080) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
services: | ||
app: | ||
build: . | ||
ports: | ||
- "8080:8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Robyn with Docker π³</title> | ||
<style> | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
font-family: 'Arial', sans-serif; | ||
background-color: #f0f0f0; | ||
text-align: center; | ||
padding-top: 50px; | ||
} | ||
h1, p { | ||
color: #333; | ||
} | ||
.container { | ||
width: 80%; | ||
margin: auto; | ||
background-color: #fff; | ||
padding: 20px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
} | ||
.emoji { | ||
font-size: 48px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Welcome to Robyn with Docker π³</h1> | ||
<p class="emoji">π¦ + π + π³ = β€οΈ</p> | ||
<p>Robyn is a fast and asynchronous web framework, built with the power of Rust π¦ and the simplicity of Python π. This unique combination allows for high-performance web applications that are easy to develop.</p> | ||
<p>And what's even better? We're running it in a Docker π³ container! This means our Robyn application is encapsulated in a lightweight, portable environment that can run almost anywhere - from your local dev machine to the cloud βοΈ - consistently and efficiently.</p> | ||
<p>So, whether you're developing microservices, APIs, or web apps, Robyn with Docker offers a robust, scalable, and enjoyable development experience. Let's dive in! π</p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
robyn |