构建文件
parent
9b9af448fc
commit
e486eed737
|
@ -0,0 +1,63 @@
|
||||||
|
FROM adoptopenjdk/openjdk11:latest
|
||||||
|
|
||||||
|
LABEL Author="axzsd" \
|
||||||
|
Email="atva725@qq.com" \
|
||||||
|
Description="cmx活动"
|
||||||
|
|
||||||
|
ENV SPRING_PROFILES_ACTIVE="dev"
|
||||||
|
ENV JAVA_OPTIONS "-Xms256m -Xmx530m \
|
||||||
|
-Dfile.encoding=UTF-8 \
|
||||||
|
-Djava.awt.headless=true \
|
||||||
|
-Dsun.net.client.defaultConnectTimeout=10000 \
|
||||||
|
-Dsun.net.client.defaultReadTimeout=30000"
|
||||||
|
|
||||||
|
#RUN apt-get update && apt-get install bash --only-upgrade \
|
||||||
|
# && apt-get install libaprutil1 --only-upgrade \
|
||||||
|
# && apt-get install coreutils --only-upgrade \
|
||||||
|
# && apt-get install libgcc1 --only-upgrade \
|
||||||
|
# && apt-get install gcc-6-base --only-upgrade \
|
||||||
|
# && apt-get install libstdc++6 --only-upgrade \
|
||||||
|
# && apt-get install multiarch-support --only-upgrade \
|
||||||
|
# && apt-get install libc6 --only-upgrade \
|
||||||
|
# && apt-get install libc-bin --only-upgrade \
|
||||||
|
# && apt-get install libpng16-16 --only-upgrade \
|
||||||
|
# && apt-get install unzip --only-upgrade \
|
||||||
|
# && apt-get install mount --only-upgrade \
|
||||||
|
# && apt-get install libsmartcols1 --only-upgrade \
|
||||||
|
# && apt-get install libblkid1 --only-upgrade \
|
||||||
|
# && apt-get install libfdisk1 --only-upgrade \
|
||||||
|
# && apt-get install libmount1 --only-upgrade \
|
||||||
|
# && apt-get install bsdutils --only-upgrade \
|
||||||
|
# && apt-get install libuuid1 --only-upgrade \
|
||||||
|
# && apt-get install util-linux --only-upgrade \
|
||||||
|
# && apt-get install gnupg-agent --only-upgrade \
|
||||||
|
# && apt-get install gpgv --only-upgrade \
|
||||||
|
# && apt-get install dirmngr --only-upgrade \
|
||||||
|
# && apt-get install gnupg --only-upgrade \
|
||||||
|
# && apt-get install libtasn1-6 --only-upgrade \
|
||||||
|
# && apt-get install ncurses-bin --only-upgrade \
|
||||||
|
# && apt-get install libncursesw5 --only-upgrade \
|
||||||
|
# && apt-get install ncurses-base --only-upgrade \
|
||||||
|
# && apt-get install libtinfo5 --only-upgrade \
|
||||||
|
# && apt-get install bash --only-upgrade \
|
||||||
|
# && apt-get install wget --only-upgrade \
|
||||||
|
# && apt-get install libsepol1 --only-upgrade \
|
||||||
|
# && apt-get install perl-base --only-upgrade \
|
||||||
|
# && apt-get install libpcre3 --only-upgrade \
|
||||||
|
# && apt-get install git --only-upgrade \
|
||||||
|
# && apt-get install git-man --only-upgrade \
|
||||||
|
# && apt-get install libncurses5 --only-upgrade \
|
||||||
|
# && apt-get install openssh-client --only-upgrade \
|
||||||
|
# && apt-get install libperl5.24 --only-upgrade \
|
||||||
|
# && apt-get install perl --only-upgrade \
|
||||||
|
# && apt-get install perl-modules-5.24 --only-upgrade \
|
||||||
|
# && apt-get install python --only-upgrade \
|
||||||
|
# && apt-get install python-minimal --only-upgrade \
|
||||||
|
# && apt-get install libpython-stdlib --only-upgrade \
|
||||||
|
# && apt clean
|
||||||
|
|
||||||
|
WORKDIR /opt
|
||||||
|
COPY hound-server/target/hound-server.jar /opt/app.jar
|
||||||
|
|
||||||
|
EXPOSE 3001
|
||||||
|
ENTRYPOINT exec java $JAVA_OPTIONS -jar -Dspring.profiles.active=${SPRING_PROFILES_ACTIVE} /opt/app.jar
|
|
@ -0,0 +1,45 @@
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
environment {
|
||||||
|
INTRANET_REGISTRY='192.168.1.124:10083'
|
||||||
|
PUBLIC_REGISTRY='192.168.1.124:10083'
|
||||||
|
IMAGE_NAMESPACE='cmx'
|
||||||
|
IMAGE_NAME='yudao-server-api'
|
||||||
|
GIT_BRANCH='feature/mall_product'
|
||||||
|
Dockerfile='builds/Dockerfile'
|
||||||
|
DockerComposefile='docker-compose-test.yml'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Pull Code') {
|
||||||
|
steps {
|
||||||
|
checkout([$class: 'GitSCM', branches: [[name: "$GIT_BRANCH"]], extensions: [], userRemoteConfigs: [[credentialsId: 'Hx-Deploy-Git', url: 'http://117.33.142.185:3000/epiboly/hound-server-parent.git']]])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('compile & buildImage->push') {
|
||||||
|
steps {
|
||||||
|
withMaven(maven: 'M3') {
|
||||||
|
sh 'mvn clean package -Dmaven.test.skip=true'
|
||||||
|
}
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'HxDockerRepo', passwordVariable: 'DOCKER_PASSWORD', usernameVariable: 'DOCKER_USERNAME')]) {
|
||||||
|
sh 'docker build -f $Dockerfile -t $INTRANET_REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$BUILD_ID .'
|
||||||
|
sh 'echo "push start..."'
|
||||||
|
sh 'docker push $INTRANET_REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$BUILD_ID'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('SSH Deploy') {
|
||||||
|
steps {
|
||||||
|
withCredentials([sshUserPrivateKey(credentialsId: 'halo-test-ssh', keyFileVariable: 'primaryKeyVar', usernameVariable: 'userVar')]) {
|
||||||
|
sh 'ssh -i ${primaryKeyVar} root@36.41.184.13 "curl -s https://cmx.bskies.cc:8000/shell/deploy/init_work_dir.sh | bash -s /opt/app/${IMAGE_NAME}"'
|
||||||
|
sh 'scp -i ${primaryKeyVar} builds/${DockerComposefile} root@36.41.184.13:/opt/app/${IMAGE_NAME}'
|
||||||
|
sh 'ssh -i ${primaryKeyVar} root@36.41.184.13 "curl -s https://cmx.bskies.cc:8000/shell/deploy/docker_deploy.sh | bash -s /opt/app/${IMAGE_NAME} $PUBLIC_REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$BUILD_ID /opt/app/${IMAGE_NAME}/$DockerComposefile"'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
version: "3.9"
|
||||||
|
services:
|
||||||
|
yudao-server:
|
||||||
|
image: ${IMAGE_VERSION}
|
||||||
|
restart: always
|
||||||
|
privileged: true
|
||||||
|
container_name: yudao-server
|
||||||
|
environment:
|
||||||
|
TZ: Asia/Shanghai
|
||||||
|
SPRING_PROFILES_ACTIVE: test
|
||||||
|
volumes:
|
||||||
|
- /opt/logs/cmx:/opt/logs
|
||||||
|
ulimits:
|
||||||
|
nproc: 65535
|
||||||
|
nofile:
|
||||||
|
soft: 20000
|
||||||
|
hard: 40000
|
||||||
|
ports:
|
||||||
|
- "3001:3001"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 600MB
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:3001/hound-api/actuator/health"]
|
||||||
|
timeout: 30s
|
||||||
|
interval: 45s
|
||||||
|
retries: 3
|
Loading…
Reference in New Issue