# 베이스 이미지로 Ubuntu 20.04 사용
FROM ubuntu:20.04

# 기본 설정
ENV DEBIAN_FRONTEND=noninteractive

# 필수 패키지 업데이트 및 설치
RUN apt-get update -y && \
    apt-get install -y openssh-server && \
    apt-get install -y vim net-tools apt-utils iputils-ping wget tar curl nginx certbot python3-certbot-nginx && \
    mkdir /var/run/sshd && \
    echo 'root:!@#gds$%^' | chpasswd && \
    sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
    sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
    sed -i 's/UsePAM yes/UsePAM no/' /etc/ssh/sshd_config && \
    rm -rf /var/lib/apt/lists/*

#run script folder and copy script
RUN mkdir /service_script
COPY start_service.sh /service_script
RUN chmod +x /service_script/start_service.sh

# Expose port
EXPOSE 22 80 443

# Run SSH,DB,TOMCAT,SVN
CMD ["/service_script/start_service.sh"]
