{"id":29353716,"url":"https://github.com/furkan000/jenkins-angular-nginx-agent-example","last_synced_at":"2026-05-09T07:05:41.835Z","repository":{"id":303671314,"uuid":"1016089987","full_name":"furkan000/jenkins-angular-nginx-agent-example","owner":"furkan000","description":"Example Jenkins CI pipeline: Build Angular → Package into Nginx Docker image. Uses Jenkins with Docker agents in a two-step process.","archived":false,"fork":false,"pushed_at":"2025-07-08T21:01:29.000Z","size":171,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-08T22:19:08.711Z","etag":null,"topics":["angular","build-automation","ci-cd","docker","jenkins","nginx"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/furkan000.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-07-08T13:25:50.000Z","updated_at":"2025-07-08T21:01:38.000Z","dependencies_parsed_at":"2025-07-08T22:19:10.804Z","dependency_job_id":"d2204a69-a795-4017-9842-404051bde2b5","html_url":"https://github.com/furkan000/jenkins-angular-nginx-agent-example","commit_stats":null,"previous_names":["furkan000/jenkins-angular","furkan000/jenkins-angular-nginx-agent-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/furkan000/jenkins-angular-nginx-agent-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/furkan000%2Fjenkins-angular-nginx-agent-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/furkan000%2Fjenkins-angular-nginx-agent-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/furkan000%2Fjenkins-angular-nginx-agent-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/furkan000%2Fjenkins-angular-nginx-agent-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/furkan000","download_url":"https://codeload.github.com/furkan000/jenkins-angular-nginx-agent-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/furkan000%2Fjenkins-angular-nginx-agent-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32810382,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["angular","build-automation","ci-cd","docker","jenkins","nginx"],"created_at":"2025-07-09T02:09:00.998Z","updated_at":"2026-05-09T07:05:41.802Z","avatar_url":"https://github.com/furkan000.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jenkins CI Pipeline: Angular Build to Nginx Docker Image\n\nThis project demonstrates a CI pipeline using **Jenkins with Docker agents** to build an Angular application and package it into an Nginx Docker image. The Jenkins server itself runs in Docker and leverages the host's Docker daemon to build and manage containers.\n\n\u003e **Note**: This guide is intended for Linux/macOS and might vary under Windows and Docker Desktop.\n\n---\n\nProject Structure\n\n```\n\nyour-project/\n├── angular-app/\n│   ├── package.json\n│   └── src/\n├── nginx-app/\n│   └── Dockerfile\n└── Jenkinsfile\n\n````\n\n---\n\n##  Project Goals\n\n- Automate Angular app builds using Jenkins.\n- Use Docker-based agents to:\n  1. Build Angular.\n  2. Build an Nginx image from the compiled output.\n- Keep builds reproducible using containerized tools (Node, Docker CLI).\n- Avoid installing Node, Angular CLI, or Docker inside Jenkins itself.\n- Reuse host-level Docker from the Jenkins container.\n\n---\n\n## 🧰 Requirements\n\nYour **host machine** (Ubuntu or other Linux) must have:\n\n- [Docker installed](https://docs.docker.com/get-docker/)\n- Jenkins runs as a **Docker container** but needs access to the **host's Docker daemon** to manage containers and build images.\n\n---\n\n## 🚀 Jenkins Setup (Used in This Project)\n\nWe used the setup described in [this Gist](https://gist.github.com/afloesch/ea855b30cfb9f157dda8c207d40f05c0), with a simplified command for local development use.\n\n### Start Jenkins with Docker Access\n\n```bash\nmkdir -p /var/jenkins_home\n\ndocker run -it -u root -p 8080:8080 -p 50000:50000 \\\n  -v /var/run/docker.sock:/var/run/docker.sock \\\n  -v $(which docker):/usr/bin/docker \\\n  -v /var/jenkins_home:/var/jenkins_home \\\n  --name jenkins jenkins/jenkins:lts\n````\n\n\u003e ⚠️ **Note**: This setup is only suitable for local development and learning. \n\n---\n\n## 🌐 Jenkins First-Time Setup\n\n1. Visit [http://localhost:8080](http://localhost:8080)\n2. Unlock Jenkins:\n\n   ```bash\n   docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword\n   ```\n3. Install Suggested Plugins\n4. Create an admin user\n\n---\n\n## 🧪 Jenkins Pipeline\n\nThe key component of this project is the [`Jenkinsfile`](./Jenkinsfile), which defines the full CI pipeline.\n\n### `Jenkinsfile`\n\n```groovy\npipeline {\n  agent none\n\n  stages {\n    stage('Build Angular') {\n      agent {\n        docker {\n          image 'node:20-alpine'\n        }\n      }\n      steps {\n        sh '''\n          cd angular-app\n          npm install -g @angular/cli\n          npm install\n          ng build --configuration=production\n        '''\n        stash includes: 'dist/**', name: 'angular-build'\n      }\n    }\n\n    stage('Build Nginx Image') {\n      agent {\n        docker {\n          image 'docker:24.0-cli'\n          args '-v /var/run/docker.sock:/var/run/docker.sock'\n        }\n      }\n      steps {\n        unstash 'angular-build'\n        sh '''\n          cp -r angular-app/dist/angular-app/browser/* ./nginx-app/\n          cd nginx-app\n          docker build -t my-angular-nginx .\n        '''\n      }\n    }\n  }\n}\n```\n\n---\n\n## 🧱 `nginx-app/Dockerfile`\n\n```Dockerfile\nFROM nginx:alpine\n\nRUN rm -rf /usr/share/nginx/html/*\nCOPY . /usr/share/nginx/html/\n```\n\nThis builds a lightweight image that serves your Angular app via Nginx.\n\n---\n\n## ✅ Running the Pipeline\n\n1. Push your code to a Git repository.\n2. Create a new **Pipeline** job in Jenkins.\n3. Configure it to use your `Jenkinsfile`.\n4. Run the pipeline.\n\n---\n\n## 🛠️ Troubleshooting\n\n- **Linux**: Add your user to the `docker` group to avoid `sudo`:\n  ```bash\n  sudo usermod -aG docker $USER\n  ```\n  Log out and back in to apply changes.\n\n- **Windows**: Ensure Docker Desktop is running and configured to expose the Docker daemon.\n\n\n## 🗒️ Notes\n\n* This guide is intended for Linux/macOS and might vary under Windows and Docker Desktop.\n* The pipeline dynamically uses Docker agents; no tools are installed on Jenkins itself.\n* Your Jenkins instance must have access to the host Docker daemon (achieved via the `-v /var/run/docker.sock:/var/run/docker.sock` mount).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffurkan000%2Fjenkins-angular-nginx-agent-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffurkan000%2Fjenkins-angular-nginx-agent-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffurkan000%2Fjenkins-angular-nginx-agent-example/lists"}