ca / Dockerfile
thenamk3's picture
Update Dockerfile
7c9bd21 verified
Raw History Blame Contribute Delete
3.76 kB
# Sử dụng buildpack-deps base image
FROM buildpack-deps:22.04-curl
# Cài đặt các gói cần thiết
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
unzip \
xz-utils \
openssh-client \
openssl \
dnsutils \
curl \
sudo \
screen \
smbclient \
wget \
rsync \
whois \
netcat \
nmap \
terminator \
tmux \
vim \
neofetch \
net-tools \
locales \
bzip2 \
python3-numpy \
supervisor \
xdotool \
zsh \
perl \
clang \
make \
dpkg \
fakeroot \
ssh \
build-essential \
cmake \
libssl-dev \
libz-dev \
&& rm -rf /var/lib/apt/lists/*
# Cài đặt ldid từ nguồn thay thế với bash
RUN git clone https://github.com/xerub/ldid.git /tmp/ldid && \
cd /tmp/ldid && \
sed -i '1s;^;#!/bin/bash\n;' make.sh && \
chmod +x make.sh && \
./make.sh && \
mv ./ldid /usr/local/bin && \
cd / && rm -rf /tmp/ldid
# Cài đặt Node.js
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs
# Cài đặt pip và Hugging Face Transformers
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3 get-pip.py && rm get-pip.py \
&& pip install transformers
# Cài đặt Theos
RUN git clone --recursive https://github.com/theos/theos.git /opt/theos
# Cài đặt OpenVSCode Server
WORKDIR /home/
ARG RELEASE_TAG="openvscode-server-v1.82.2"
ARG RELEASE_ORG="gitpod-io"
ARG OPENVSCODE_SERVER_ROOT="/home/.openvscode-server"
RUN if [ -z "${RELEASE_TAG}" ]; then \
echo "The RELEASE_TAG build arg must be set." >&2 && \
exit 1; \
fi && \
arch=$(uname -m) && \
if [ "${arch}" = "x86_64" ]; then \
arch="x64"; \
elif [ "${arch}" = "aarch64" ]; then \
arch="arm64"; \
elif [ "${arch}" = "armv7l" ]; then \
arch="armhf"; \
fi && \
wget https://github.com/${RELEASE_ORG}/openvscode-server/releases/download/${RELEASE_TAG}/${RELEASE_TAG}-linux-${arch}.tar.gz && \
tar -xzf ${RELEASE_TAG}-linux-${arch}.tar.gz && \
mv -f ${RELEASE_TAG}-linux-${arch} ${OPENVSCODE_SERVER_ROOT} && \
cp ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/openvscode-server ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/code && \
rm -f ${RELEASE_TAG}-linux-${arch}.tar.gz
# Tạo người dùng và nhóm người dùng
ARG USERNAME=user
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m -s /bin/bash $USERNAME \
&& echo "$USERNAME ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
# Thiết lập quyền sở hữu và môi trường làm việc
RUN mkdir -p /home/nemg && \
chown -R $USER_UID:$USER_GID /home/nemg && \
chown -R $USER_UID:$USER_GID ${OPENVSCODE_SERVER_ROOT} && \
mkdir -p /data && \
chown $USER_UID:$USER_GID /data
USER $USERNAME
WORKDIR /home/nemg/
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
HOME=/home/nemg \
EDITOR=code \
VISUAL=code \
GIT_EDITOR="code --wait" \
THEOS=/opt/theos \
PATH=$THEOS/bin:$PATH \
OPENVSCODE_SERVER_ROOT=${OPENVSCODE_SERVER_ROOT}
# Cài đặt Oh My Zsh
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Cài đặt các extension của VS Code
ENV OPENVSCODE="${OPENVSCODE_SERVER_ROOT}/bin/openvscode-server"
RUN ${OPENVSCODE} --install-extension ms-python.python && \
${OPENVSCODE} --install-extension monokai.theme-monokai-pro-vscode
EXPOSE 7860
ENTRYPOINT [ "/bin/sh", "-c", "exec ${OPENVSCODE_SERVER_ROOT}/bin/openvscode-server --host 0.0.0.0 --port 7860 --without-connection-token"]