FROM alpine
ENV USERNAME="shelluser" \
    PASSWORD="" \
    SUDO_OK="false" \
    AUTOLOGIN="true" \
    TZ="Etc/UTC"

COPY ./entrypoint.sh /
COPY --chmod=011 ./bin/minishell /bin/minishell

RUN apk update && \
    apk add --no-cache tini ttyd tzdata vim nano && \
    chmod 700 /entrypoint.sh && \
    touch /etc/.firstrun && \
    ln -s "/usr/share/zoneinfo/$TZ" /etc/localtime && \
    echo $TZ > /etc/timezone

RUN rm -f /bin/ping /bin/ping6 /usr/bin/wget /usr/bin/curl \
    /usr/bin/nc /usr/bin/telnet /sbin/ip /bin/netstat

ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/entrypoint.sh"]
