I need to set up a CI/CD pipeline for a MERN stack application using Jenkins. The build process will run on the Jenkins server, and deployment will happen on a separate server. The application runs in Docker container, but I can't use Docker Hub or any other registry to store images for CICD process. How can I achieve this?
You can follow these steps:
Build Docker Image on Jenkins: Create a Jenkinsfile to define a build stage that builds the Docker image directly on the Jenkins server.
Use a Local Docker Registry: Set up a local Docker registry on either the Jenkins server or the deployment server. After building the image, tag it and push it to the local registry.
Deploy on Separate Server: On the deployment server, pull the Docker image from the local registry and run the container.