Commit 07ecc532 authored by 周健君's avatar 周健君

add Dockerfile and Jenkinsfile

parent c645084e
FROM ccr.ccs.tencentyun.com/gm-base/py3.8:v1.0
COPY ./requirements.txt /tmp
WORKDIR /srv/apps/backend-auto/
RUN apk add --no-cache --virtual .build-deps \
bzip2-dev \
coreutils \
dpkg-dev dpkg \
expat-dev \
findutils \
gcc \
gdbm-dev \
libc-dev \
libffi-dev \
libnsl-dev \
libressl-dev \
libtirpc-dev \
linux-headers \
make \
ncurses-dev \
pax-utils \
readline-dev \
sqlite-dev \
tcl-dev \
tk \
tk-dev \
xz-dev \
zlib-dev \
# 业务相关依赖和安装工具
linux-headers \
python-dev \
# librdkafka-dev=0.11.6-r1 \
mariadb-client \
mariadb-dev \
git \
openssh \
\
# 取消ssh第一次链接的确认
&& echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config \
# && pip install six verlib \
&& pip install --no-cache-dir -r /tmp/requirements.txt
COPY . /srv/apps/backend-auto/
WORKDIR /srv/apps/backend-auto/
RUN apk del .build-deps
CMD python run.py
\ No newline at end of file
@Library('gm-pipeline-library') _
pipeline {
agent any
options {
// Console output add timestamps
timestamps()
// Disallow concurrent executions of the Pipeline
disableConcurrentBuilds()
// On failure, retry the entire Pipeline the specified number of times.
retry(1)
}
parameters {
choice(name: 'CACHE', choices: ['', '--no-cache'], description: 'docker build 是否使用cache,默认使用,不使用为--no-cache')
}
environment {
// Image Tag branch.time.hash
TAG = dockerTag()
// Image Full Tag
IMAGE = "${DOCKER_REGISTRY}/gm-backend/autotest-backend:$TAG"
ALIAS = "${DOCKER_REGISTRY}/gm-backend/autotest-backend:v1.0.0"
}
stages {
stage("Begin") {
steps {
dingNotify "before"
}
}
stage('Build Image') {
steps {
sh "docker build . ${params.CACHE} -t $IMAGE -f ./Dockerfile"
sh "docker push $IMAGE"
sh "docker tag $IMAGE $ALIAS && docker push $ALIAS"
}
}
}
post {
always {
dingNotify "after", "${currentBuild.currentResult}"
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment