69 lines
2.2 KiB
Docker
69 lines
2.2 KiB
Docker
FROM python:3.11
|
|
|
|
# image info
|
|
LABEL Project="CloudCenter"
|
|
LABEL Author="lzwang"
|
|
LABEL Email="zhuangwang82@gmail.com"
|
|
LABEL Version=0.3
|
|
|
|
# setup volume
|
|
VOLUME /project
|
|
|
|
# setup workdir
|
|
WORKDIR /project
|
|
|
|
# setup mirrors of apt
|
|
# https://mirrors.tuna.tsinghua.edu.cn/help/debian/
|
|
RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free" > /etc/apt/sources.list \
|
|
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free" >> /etc/apt/sources.list \
|
|
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free" >> /etc/apt/sources.list \
|
|
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free" >> /etc/apt/sources.list
|
|
|
|
# update apt packages [Basic]
|
|
RUN apt-get update -y && apt-get upgrade -y \
|
|
&& apt-get install apt-utils -y \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# install nodejs 21
|
|
# https://github.com/nodesource/distributions/blob/master/README.md#debinstall
|
|
RUN curl -SLO https://deb.nodesource.com/nsolid_setup_deb.sh \
|
|
&& chmod 500 nsolid_setup_deb.sh \
|
|
&& ./nsolid_setup_deb.sh 21 \
|
|
&& apt-get install nodejs -y \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# setup nodejs
|
|
RUN npm install -g cnpm --registry=https://registry.npm.taobao.org \
|
|
&& echo "alias npm=cnpm" >> /root/.bashrc \
|
|
&& npm config set registry https://registry.npm.taobao.org
|
|
|
|
# copy gitsh script
|
|
COPY ./scripts/gitsh /project/tools/gitsh
|
|
RUN chmod +x /project/tools/gitsh
|
|
|
|
# setup mirrors of pip
|
|
# https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
|
|
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
|
|
|
# install dependencies
|
|
COPY ./cloud-center/requirements.txt /project/requirements.txt
|
|
RUN pip install --upgrade pip \
|
|
&& pip install -r /project/requirements.txt \
|
|
&& rm -rf /root/.cache \
|
|
&& rm -rf /tmp/*
|
|
|
|
# install Debian packages [Extra]
|
|
RUN apt-get update -y && apt-get upgrade -y \
|
|
&& apt-get install vim pngquant -y \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# setup alias
|
|
RUN echo "alias ll='ls -la'" >> /root/.bashrc
|
|
|
|
# setup timezone
|
|
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
|
&& date
|
|
|
|
# on start up
|
|
CMD ["python3"]
|