Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Dockerfile #51

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:3
RUN pip install django==3.2

COPY . .
RUN python manage.py makemigrations
RUN python manage.py migrate
EXPOSE 8000
CMD ["python","manange.py","runserver",0.0.0.0:8000]
33 changes: 33 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
pipeline {
agent any

environment {
IMAGE_TAG="${BUILD_NUMBER}"
}

stages {
stage('Code') {
steps {
git url:'https://github.com/himanshurkt96/django-todo-python.git', branch:'develop'
}
}

stage('Build') {
steps {
sh 'docker build . -t himanshurkt96/cicd-todo:${BUILD_NUMBER}'
}
}

stage('Push') {
steps {
withCredentials([usernamePassword(credentialsId: 'dockerHub', passwordVariable: 'dockerHubPassword', usernameVariable: 'dockerHubUser')]) {
sh "docker login -u ${env.dockerHubUser} -p ${env.dockerHubPassword}"

sh 'docker push himanshurkt96/cicd-todo:${BUILD_NUMBER}'
}
}
}

}

}