Skip to content

Instantly share code, notes, and snippets.

@parsa-asgari
Created February 20, 2022 06:23
Show Gist options
  • Save parsa-asgari/c453ad5bbacdcb6b1c71919beed19464 to your computer and use it in GitHub Desktop.
Save parsa-asgari/c453ad5bbacdcb6b1c71919beed19464 to your computer and use it in GitHub Desktop.
simple Jenkinsfile using Docker and Django
node{
git branch: "master", url: "http://192.168.100.185:3000/parsa/Django_cicd"
stage ('Build the Docker image') {
sh "echo building the image..."
sh "docker build --tag django_test:latest ."
sh "echo building image complete."
}
stage ('Deploy the Docker image') {
sh "echo Deploying the container..."
sh " docker rm -f django_test"
sh "docker run -d -p 192.168.100.146:8000:8000 --name django_test django_test:latest "
sh "echo Container successfully deployed."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment