diff --git a/.jenkinsfile b/.jenkinsfile new file mode 100644 index 0000000..8c42af9 --- /dev/null +++ b/.jenkinsfile @@ -0,0 +1,57 @@ +pipeline { + agent any + options { + timeout(time: 30, unit: 'MINUTES') + disableConcurrentBuilds abortPrevious: true + } + triggers { + cron(env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'develop' ? '0 9 * * *' : '') + } + environment { + REGISTRY_ADDRESS = "gitea.atria-soft.org" + REGISTRY_ADDRESS_FULL = "https://${REGISTRY_ADDRESS}" + REPOSITORY_BASE_NAME = 'kangaroo-and-rabbit/docker-builder' + TAG_DOCKER = getEnvName(env.BRANCH_NAME) + DOCKER_IMAGE_NAME_AND_TAG = "kangaroo-and-rabbit/archlinux-builder:${TAG_DOCKER}" + } + stages { + stage('save-evironment') { + steps { + sh 'ls -la' + sh 'pwd' + sh 'uname -a' + sh 'printenv | sort' + sh 'git log -n 20' + sh 'javac --version' + } + } + stage('(prod) Build') { + steps { + sh 'docker build -t ${DOCKER_IMAGE_NAME_AND_TAG} .' + } + } + stage('(prod) Push on registry') { + when { + expression { + return env.TAG_DOCKER != 'other'; + } + } + steps { + script { + docker.withRegistry(env.REGISTRY_ADDRESS_FULL, 'jenkins_auth_registry') { + docker.image(env.DOCKER_IMAGE_NAME_AND_TAG).push(); + } + } + } + } + } +} + +def getEnvName(branchName) { + if("master".equals(branchName)) { + return "latest"; + } else if("dev".equals(branchName)) { + return "dev"; + } + return "other"; +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..96feeb2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,47 @@ +FROM archlinux:latest + +USER root + +# update system +RUN pacman -Syu --noconfirm \ + && \ + pacman-db-upgrade \ + && \ + pacman -S --noconfirm \ + jdk-openjdk \ + maven \ + npm \ + gcc \ + clang \ + make \ + python \ + python-pip \ + php \ + git \ + && \ + pacman -Scc --noconfirm + +RUN pip install \ + island \ + lutin \ + flake8 \ + flake8-annotations \ + flake8-blind-except \ + flake8-bugbear \ + flake8-builtins \ + flake8-comprehensions \ + flake8-deprecated==1.3 \ + flake8-executable \ + flake8-isort \ + flake8-use-fstring \ + black \ + isort \ + mypy \ + docker-compose \ + docker + +ENV PATH /tmp/node_modules/.bin:$PATH + +WORKDIR /workspace/ + +CMD ["/usr/bin/sleep", "5121512"]