zxc
BOT_open_sesam/pipeline/head There was a failure building this commit
Details
BOT_open_sesam/pipeline/head There was a failure building this commit
Details
parent
b240bc1bad
commit
54afe573c1
|
|
@ -1,24 +1,42 @@
|
|||
pipeline {
|
||||
environment {
|
||||
REGISTRY_URL = "https://proxy.docker.dataekb.ru/local_cache"
|
||||
IMAGE_NAME = "bot_open_sesam"
|
||||
IMAGE_TAG = "latest"
|
||||
BOT_IMAGE_NAME = "bot_open_sesam"
|
||||
TUNNEL_IMAGE_NAME = "tunnel_open_sesam"
|
||||
BOT_IMAGE_TAG = "latest"
|
||||
TUNNEL_IMAGE_TAG = "latest"
|
||||
}
|
||||
|
||||
agent { label 'agent_smith'}
|
||||
|
||||
stages {
|
||||
|
||||
stage ('push main') {
|
||||
stage ('build bot image and push') {
|
||||
steps {
|
||||
script {
|
||||
docker.withRegistry("${REGISTRY_URL}", 'jenkins_harbor') {
|
||||
def customImage = docker.build("proxy.docker.dataekb.ru/local_cache/${IMAGE_NAME}:latest")
|
||||
customImage.push()
|
||||
def BotImage = docker.build(
|
||||
"${REGISTRY_URL}/${BOT_IMAGE_NAME}:${BOT_IMAGE_TAG}"
|
||||
"-f ./tunnel/Dockerfile.tunnel ."
|
||||
)
|
||||
BotImage.push()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('build tunnel image and push') {
|
||||
steps {
|
||||
script {
|
||||
docker.withRegistry("${REGISTRY_URL}", 'jenkins_harbor') {
|
||||
def TunnelImage = docker.build(
|
||||
"${REGISTRY}/${TUNNEL_IMAGE_NAME}:${TUNNEL_IMAGE_TAG}",
|
||||
"-f ./tunnel/Dockerfile.tunnel ."
|
||||
)
|
||||
TunnelImage.push()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage ('clear after build and push') {
|
||||
steps {
|
||||
|
|
@ -38,8 +56,13 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
post {
|
||||
success {
|
||||
echo "Оба образа собраны и задеплоены успешно"
|
||||
}
|
||||
failure {
|
||||
echo "Ошибка сборки!"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,11 +10,39 @@ services:
|
|||
restart: always
|
||||
networks:
|
||||
- bot_open_sesam_network
|
||||
depends_on:
|
||||
tunnel_open_sesam:
|
||||
condition: service_healthy
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
tunnel_open_sesam:
|
||||
image: proxy.docker.dataekb.ru/local_cache/tunnel_open_sesam:latest
|
||||
container_name: tunnel_open_sesam
|
||||
env_file:
|
||||
- ./.env
|
||||
# environment:
|
||||
# - SSH_HOST=91.194.84.91
|
||||
# - SSH_PORT=22
|
||||
# - SSH_USER=root
|
||||
volumes:
|
||||
# SSH ключ
|
||||
- ~/.ssh/id_rsa:/root/.ssh/id_rsa:ro
|
||||
networks:
|
||||
- bot_open_sesam_network
|
||||
restart: always
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-z", "localhost", "1080"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
bot_open_sesam_network:
|
||||
driver: bridge
|
||||
|
|
|
|||
3
main.py
3
main.py
|
|
@ -14,12 +14,11 @@ from config import config
|
|||
|
||||
# BOT_TOKEN = config["BOT_TOKEN"]
|
||||
BOT_TOKEN=os.environ.get('BOT_TOKEN')
|
||||
PROXY_URL = os.environ.get('PROXY_URL')
|
||||
|
||||
dp = Dispatcher()
|
||||
register_all_handlers(dp)
|
||||
|
||||
PROXY_URL = os.environ.get('PROXY_URL')
|
||||
|
||||
session = AiohttpSession(proxy=PROXY_URL)
|
||||
|
||||
async def main() -> None:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
# tunnel/Dockerfile
|
||||
FROM alpine:3.19
|
||||
|
||||
RUN apk add --no-cache \
|
||||
autossh \
|
||||
openssh-client
|
||||
|
||||
# Директория для SSH ключей
|
||||
RUN mkdir -p /root/.ssh && \
|
||||
chmod 700 /root/.ssh
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
# tunnel/entrypoint.sh
|
||||
#!/bin/sh
|
||||
|
||||
# Права на ключ
|
||||
chmod 600 /root/.ssh/id_rsa
|
||||
|
||||
# Добавляем сервер в known_hosts
|
||||
ssh-keyscan -p ${SSH_PORT:-22} ${SSH_HOST} >> /root/.ssh/known_hosts 2>/dev/null
|
||||
|
||||
echo "Запуск AutoSSH туннеля → ${SSH_USER}@${SSH_HOST}:${SSH_PORT:-22}"
|
||||
|
||||
exec autossh \
|
||||
-M 0 \
|
||||
-N \
|
||||
-D 0.0.0.0:1080 \
|
||||
-o "ServerAliveInterval=30" \
|
||||
-o "ServerAliveCountMax=3" \
|
||||
-o "ExitOnForwardFailure=yes" \
|
||||
-o "StrictHostKeyChecking=no" \
|
||||
-o "ConnectTimeout=10" \
|
||||
-p ${SSH_PORT:-22} \
|
||||
-i /root/.ssh/id_rsa \
|
||||
${SSH_USER}@${SSH_HOST}
|
||||
Loading…
Reference in New Issue