diff --git a/Dockerfile b/Dockerfile index 1b03272..42b59da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ FROM python:3.10-alpine -WORKDIR /app +WORKDIR /app/ ENV PYTHONIOENCODING=utf-8 -COPY Pipfile Pipfile.lock everybody.txt tweetbot.py /app +COPY Pipfile Pipfile.lock everybody.txt tweetbot.py /app/ # Install pipenv and compilation dependencies RUN pip install pipenv && pipenv install --deploy --ignore-pipfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..4c7c338 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,70 @@ +pipeline { + + agent none + + environment { + HOME = "${env.WORKSPACE}" + DOCKER_REGISTRY = 'https://registry.digitalocean.com' + DOCKER_IMAGE_NAME = 'registry.digitalocean.com/ailuridae-registry/ailuridae.io/everybodymov' + DOCKER_IMAGE = '' + } + + stages { + stage('Setup') { + agent { + docker { + image 'python:3.10-slim-bullseye' + } + } + steps { + sh 'python -m pip install --no-cache-dir --upgrade --user pip' + sh 'python -m pip install --no-cache-dir pipenv --user' + sh 'python -m pipenv install --dev' + } + } + stage('Check') { + agent { + docker { + image 'python:3.10-slim-bullseye' + } + } + steps { + sh 'python -m pipenv verify' + sh 'python -m pipenv check --clear' + sh 'python -m pipenv run bandit *.py' + } + } + stage('Build') { + agent { + label 'main' + } + steps { + script { + DOCKER_IMAGE = docker.build("${DOCKER_IMAGE_NAME}") + } + } + } + stage('Publish') { + agent { + label 'main' + } + steps { + script { + docker.withRegistry(env.DOCKER_REGISTRY, 'digital-ocean-ailuridae-registry') { + DOCKER_IMAGE.push("${BUILD_NUMBER}") + DOCKER_IMAGE.push('latest') + } + } + } + } + } + + post { + always { + node('main') { + cleanWs() + } + } + } + +} \ No newline at end of file diff --git a/Pipfile.lock b/Pipfile.lock index cae1a37..be369d1 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "3dc4c0a387fc9c5280d0dbfadae8f3d7cac3ddf589af5ec78dfe7090ff2684f2" + "sha256": "e7a1785570cb6182573b0e15cae2ad2c86adb2c280e88ceaa9126c232b720c9c" }, "pipfile-spec": 6, "requires": {