This repository demonstrates setting up a Jenkins pipeline for that builds the Docker image of a basic react application.
- Docker installed on your Jenkins server or machine: Install Docker
- Jenkins installed and running: Install Jenkins
Ensure the following plugins are installed in Jenkins:
- Docker Plugin: Allows Jenkins to use Docker to run builds.
- Pipeline Plugin: Provides support for Pipeline as Code.
-
Start Jenkins:
- Follow installation instructions to start Jenkins.
- Access Jenkins at
http://localhost:8080
(or configured port).
-
Set up Docker Hub Credentials (if applicable):
- Go to Jenkins > Credentials.
- Add Docker Hub username and password as secret text credentials.
-
Create a New Pipeline Project:
- Click on "New Item" on Jenkins dashboard.
- Enter a name (e.g.,
my-react-app-pipeline
) and select "Pipeline" as project type.
-
Configure Pipeline from SCM:
- Under "Pipeline" section, choose "Pipeline script from SCM".
- Select your SCM (e.g., Git) and enter repository URL (
https://github.com/your-username/my-react-app
).
-
Save and Run Pipeline:
- Save your pipeline configuration.
- Click "Build Now" to run the pipeline manually for the first time.
- Jenkins will execute the steps defined in
Jenkinsfile
(located in your repository). - Customize
Jenkinsfile
to define build, test, and deployment stages specific to your React application.