代码拉取完成,页面将自动刷新
# 使用官方的Ubuntu作为基础镜像
FROM ubuntu:22.04
# 设置环境变量
ENV DEBIAN_FRONTEND=noninteractive
# 安装需要的包
RUN apt-get update && apt-get install -y supervisor net-tools curl vim jq binutils build-essential patchelf
# 添加Salt Stack的源
RUN curl -fsSL -o /etc/apt/keyrings/salt-archive-keyring-2023.gpg https://repo.saltproject.io/salt/py3/ubuntu/22.04/amd64/SALT-PROJECT-GPG-PUBKEY-2023.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/salt-archive-keyring-2023.gpg arch=amd64] https://repo.saltproject.io/salt/py3/ubuntu/22.04/amd64/latest jammy main" | tee /etc/apt/sources.list.d/salt.list
# 安装Salt Stack
RUN apt-get update && apt-get install -y \
salt-master salt-minion salt-ssh salt-syndic salt-cloud salt-api \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# 创建必要的文件夹
RUN mkdir -p /srv/salt
# 将当前目录的内容复制到容器的/app目录
ADD ./config/salt/master /etc/salt/master
ADD ./config/salt/minion /etc/salt/minion
ADD ./config/supervisor/salt-master.conf /etc/supervisor/conf.d/salt-master.conf
ADD ./config/supervisor/salt-api.conf /etc/supervisor/conf.d/salt-api.conf
RUN /opt/saltstack/salt/bin/pip install psycopg2-binary sqlalchemy records
# 设置挂载点
VOLUME ["/etc/salt","/var/log/salt","/var/cache/salt","/srv/salt","/srv/pillar"]
# 设置开放端口
EXPOSE 4505 4506
# 创建新用户
RUN useradd -M -s /sbin/nologin saltapi
RUN echo "saltapi:Changeme" | chpasswd
COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
WORKDIR /
# 定义容器启动命令
CMD [ "supervisord","-n" ]
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。