forked from DevOps/deploy.stack
build(ansible): 添加env.cfg和docker-compose.yml文件并更新dockerfile
添加env.cfg文件用于配置镜像标签,docker-compose.yml文件用于定义Ansible服务容器。更新dockerfile以优化依赖安装和容器入口点配置,确保容器运行更高效和安全。
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
# BUILD:: docker buildx build --platform linux/amd64 -t hub.tp229.com:3500/ansible-alpine:py3.13-rootless .
|
||||
FROM python:3.13.3-alpine
|
||||
# 使用国内镜像源
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
||||
|
||||
# 安装必要的依赖
|
||||
RUN apk add --no-cache \
|
||||
RUN apk add --update --no-cache \
|
||||
openssh-client \
|
||||
sshpass \
|
||||
bash \
|
||||
git \
|
||||
rsync
|
||||
|
||||
# 安装Ansible及相关工具
|
||||
RUN pip install --no-cache-dir \
|
||||
-i https://mirrors.ustc.edu.cn/pypi/simple \
|
||||
ansible \
|
||||
ansible-lint \
|
||||
jmespath
|
||||
ansible-lint
|
||||
|
||||
# 创建非root用户(安全建议)
|
||||
RUN adduser -D ansible-user
|
||||
@@ -21,5 +23,5 @@ USER ansible-user
|
||||
WORKDIR /home/ansible-user
|
||||
|
||||
# 入口点配置
|
||||
ENTRYPOINT ["ansible"]
|
||||
CMD ["--version"]
|
||||
ENTRYPOINT []
|
||||
CMD ["ansible", "--version"]
|
||||
Reference in New Issue
Block a user