FROM alpine:3.18

RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories && \
    echo "http://mirrors.aliyun.com/alpine/latest-stable/community/" >> /etc/apk/repositories

RUN apk update && \
    apk add --no-cache openssh-server tzdata python3 && \
    apk add --update --no-cache curl jq py3-configobj py3-pip py3-setuptools python3 python3-dev && \
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config && \
    ssh-keygen -A && \
    echo "root:Password1" | chpasswd

RUN apk add --no-cache ansible openssh sshpass

# RUN mkdir -p /etc/ansible && \
#     ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa &&\
#     echo 'StrictHostKeyChecking no' >>/etc/ssh/ssh_config

#hslaws
WORKDIR /app

COPY . /app/ 
# COPY requirements.txt . 
COPY ./docker/entrypoint.sh /usr/local/bin/entrypoint.sh

RUN mv /usr/lib/python3.11/EXTERNALLY-MANAGED /usr/lib/python3.11/EXTERNALLY-MANAGED.bak && \
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip && \
# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  -r requirements.txt && \
chmod +x /usr/local/bin/entrypoint.sh

EXPOSE 22 
EXPOSE 6080

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]