FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV PYTHONUNBUFFERED=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ARG APT_MIRROR=https://repo.huaweicloud.com/ubuntu
ARG PIP_INDEX_URL=https://repo.huaweicloud.com/repository/pypi/simple/
RUN printf 'Acquire::Retries "5";\nAcquire::http::Timeout "30";\nAcquire::https::Timeout "30";\n' > /etc/apt/apt.conf.d/99devcontainer-retries \
&& apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& sed -i "s|http://archive.ubuntu.com/ubuntu|${APT_MIRROR}|g; s|http://security.ubuntu.com/ubuntu|${APT_MIRROR}|g" /etc/apt/sources.list \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
git \
openssh-client \
sshpass \
curl \
wget \
tar \
unzip \
bzip2 \
xz-utils \
iproute2 \
net-tools \
iputils-ping \
lsb-release \
sudo \
less \
jq \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip config set global.index-url "${PIP_INDEX_URL}" \
&& python3 -m pip install --upgrade pip setuptools wheel
RUN useradd -m -s /bin/bash developer \
&& echo "developer ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/developer \
&& chmod 0440 /etc/sudoers.d/developer
USER developer
WORKDIR /workspaces/ascend-deployer