forked from DevOps/deploy.stack
添加env.cfg文件用于配置镜像标签,docker-compose.yml文件用于定义Ansible服务容器。更新dockerfile以优化依赖安装和容器入口点配置,确保容器运行更高效和安全。
27 lines
685 B
Plaintext
27 lines
685 B
Plaintext
# 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 --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
|
||
|
||
# 创建非root用户(安全建议)
|
||
RUN adduser -D ansible-user
|
||
USER ansible-user
|
||
WORKDIR /home/ansible-user
|
||
|
||
# 入口点配置
|
||
ENTRYPOINT []
|
||
CMD ["ansible", "--version"] |