{"id":29693901,"url":"https://github.com/graphtylove/jenkins-demo","last_synced_at":"2025-07-23T08:10:02.110Z","repository":{"id":299654003,"uuid":"1003735453","full_name":"GraphtyLove/jenkins-demo","owner":"GraphtyLove","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-17T16:37:27.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-17T16:44:30.581Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GraphtyLove.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-17T15:30:52.000Z","updated_at":"2025-06-17T16:37:30.000Z","dependencies_parsed_at":"2025-06-17T16:54:46.146Z","dependency_job_id":null,"html_url":"https://github.com/GraphtyLove/jenkins-demo","commit_stats":null,"previous_names":["graphtylove/jenkins-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GraphtyLove/jenkins-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GraphtyLove%2Fjenkins-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GraphtyLove%2Fjenkins-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GraphtyLove%2Fjenkins-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GraphtyLove%2Fjenkins-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GraphtyLove","download_url":"https://codeload.github.com/GraphtyLove/jenkins-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GraphtyLove%2Fjenkins-demo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266640830,"owners_count":23960809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-23T08:10:01.503Z","updated_at":"2025-07-23T08:10:02.084Z","avatar_url":"https://github.com/GraphtyLove.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jekins deployment FastAPI with Docker demo\n\nThis is a dead simple FastAPI application with [Jenkins](https://www.jenkins.io/) [CI/CD](https://github.com/resources/articles/devops/ci-cd) integration. \n\nIt demonstrates how to build, deploy, and serve a Python [FastAPI](https://fastapi.tiangolo.com/) app on [Docker](https://www.docker.com/) with automated deployment on every push to the `main` branch.\n\n![Jenkins logo](https://upload.wikimedia.org/wikipedia/commons/e/e3/Jenkins_logo_with_title.svg)\n\n---\n\n## 🚀 Features\n- **FastAPI** app with two endpoints:\n  - `/` — Returns `Hello, world!`\n  - `/user/{name}` — Returns `Hello {name}`\n  - `/docs` — Show the documentation of your API *(auto-generated by FastAPI)*\n- **Jenkins Pipeline** for automated deployment on every push to `main`\n\n---\n\n## 📂 Project Structure\n```\njenkins-demo/\n├── Jenkinsfile         # Jenkins pipeline definition\n├── main.py             # FastAPI application\n├── requirements.txt    # Python dependencies\n└── README.md           # Project documentation\n```\n\n---\n\n## 🖥️ Endpoints\n\n### `GET /`\nReturns a simple hello world message.\n\n**Response:**\n```\nHello, world!\n```\n\n### `GET /user/{name}`\nReturns a personalized hello message.\n\n**Example:**\n```\nGET /user/Alice\n```\n**Response:**\n```\nHello Alice\n```\n\n---\n## 🤖 Jenkins CI/CD Pipeline\n\nThis project includes a `Jenkinsfile` for automated deployment:\n\n- **Trigger:** On every push to the `main` branch (to configure in Jenkins UI)\n- **Steps:**\n  1. Build the Docker image\n  2. Run the container\n\n### Jenkinsfile Overview\n```groovy\npipeline {\n    agent any\n\n    stages {\n      \n      // 1. Build the docker image on the server\n        stage('Build Docker Image') {\n            steps {\n                sh 'docker build -t fastapi-image.'\n            }\n        }\n        \n        // 2. Delete the old container and deploy a new one\n        stage('Run Docker Container') {\n            steps {\n                sh 'docker rm -f fastapi-app-container || true'\n                sh 'docker run -d --name fastapi-app-container -p 8081:8081 fastapi-image'\n            }\n        }\n    \n    }\n}\n```\n\n### Jenkins Setup Instructions\n1. **Install Jenkins** and required plugins (e.g., Git, Pipeline).\n2. **Create a new Pipeline job** and point it to your repository.\n3. **Ensure Docker are available** on the Jenkins agent. (already done on our Becode server)\n4. **Configure credentials** if your repository is private.\n5. **Start the pipeline** — it will auto-deploy on every push to `main`. (when configured in the UI)\n\n---\n\n## ⚙️ Local Development (Advanced)\n\n1. **Clone the repository:**\n   ```bash\n   git clone \u003cyour-repo-url\u003e\n   cd jenkins-demo\n   ```\n2. **Create a virtual environment and install dependencies:**\n   ```bash\n   python3 -m venv venv\n   source venv/bin/activate\n   pip install -r requirements.txt\n   ```\n3. **Run the FastAPI app:**\n   ```bash\n   uvicorn main:app --reload\n   ```\n4. **Access the app:**\n   - [http://localhost:8000/](http://localhost:8000/) — Hello World\n   - [http://localhost:8000/user/YourName](http://localhost:8000/user/YourName) — Personalized Hello\n   - [http://localhost:8000/docs](http://localhost:8000/docs) — The documentation of your API\n\n---\n\n## 📄 License\nMIT ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphtylove%2Fjenkins-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphtylove%2Fjenkins-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphtylove%2Fjenkins-demo/lists"}