diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..d7e4a49 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine +RUN apk add --no-cache curl wget busybox-extras netcat-openbsd python3 py3-pip bash && \ + pip install awscli && \ + apk --purge -v del py3-pip +CMD tail -f /dev/null diff --git a/docker/toolbox/Dockerfile b/docker/toolbox/Dockerfile index cae61c5..2e4cc14 100644 --- a/docker/toolbox/Dockerfile +++ b/docker/toolbox/Dockerfile @@ -1,5 +1,6 @@ FROM alpine -RUN apk add --no-cache curl wget busybox-extras netcat-openbsd python py-pip bash && \ +RUN apk add --no-cache curl wget busybox-extras netcat-openbsd python3 py3-pip bash postgresql-client && \ pip install awscli -RUN apk --purge -v del py-pip +RUN apk --purge -v del py3-pip CMD tail -f /dev/null + diff --git a/jenkinsfiles/docker_jenkins.jenkins b/jenkinsfiles/docker_jenkins.jenkins new file mode 100644 index 0000000..83453d1 --- /dev/null +++ b/jenkinsfiles/docker_jenkins.jenkins @@ -0,0 +1,37 @@ +pipeline { + agent { + label 'master' + } + triggers { + pollSCM('* * * * *') + } + options { + buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) + timestamps() + } + stages { + stage("Docker Build and Push") { + steps { + script { + try { + echo "============= Starting Docker Build and Push =============" + withCredentials([usernamePassword(credentialsId: 'dockerhub_nmore', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { + sh """ + docker login -u \$USERNAME -p \$PASSWORD + """ + } + + dir('docker/toolbox') { + sh 'docker build -t nmorework/nmore:latest .' + } + + sh 'docker push nmorework/nmore:latest' + } catch (Exception e) { + currentBuild.result = 'FAILURE' + error("Build and push failed: ${e.message}") + } + } + } + } + } +}