-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
142 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
FROM python:3.10.11-alpine | ||
RUN apk add --no-cache --virtual .build-deps \ | ||
libffi-dev \ | ||
gcc \ | ||
musl-dev \ | ||
libxml2-dev \ | ||
libxslt-dev \ | ||
&& apk add --no-cache $(echo $(wget --no-check-certificate -qO- https://raw.githubusercontent.com/hsuyelin/nas-tools/beta/package_list.txt)) \ | ||
&& curl https://rclone.org/install.sh | bash \ | ||
&& if [ "$(uname -m)" = "x86_64" ]; then ARCH=amd64; elif [ "$(uname -m)" = "aarch64" ]; then ARCH=arm64; fi \ | ||
&& curl https://dl.min.io/client/mc/release/linux-${ARCH}/mc --create-dirs -o /usr/bin/mc \ | ||
&& chmod +x /usr/bin/mc \ | ||
&& pip install --upgrade pip setuptools wheel \ | ||
&& pip install cython \ | ||
&& pip install -r https://raw.githubusercontent.com/hsuyelin/nas-tools/beta/requirements.txt \ | ||
&& apk del --purge .build-deps \ | ||
&& rm -rf /tmp/* /root/.cache /var/cache/apk/* | ||
ENV S6_SERVICES_GRACETIME=30000 \ | ||
S6_KILL_GRACETIME=60000 \ | ||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ | ||
S6_SYNC_DISKS=1 \ | ||
HOME="/nt" \ | ||
TERM="xterm" \ | ||
PATH=${PATH}:/usr/lib/chromium \ | ||
LANG="C.UTF-8" \ | ||
TZ="Asia/Shanghai" \ | ||
NASTOOL_CONFIG="/config/config.yaml" \ | ||
NASTOOL_AUTO_UPDATE=false \ | ||
NASTOOL_CN_UPDATE=true \ | ||
NASTOOL_VERSION=beta \ | ||
PS1="\u@\h:\w \$ " \ | ||
REPO_URL="https://github.com/hsuyelin/nas-tools.git" \ | ||
PYPI_MIRROR="https://pypi.tuna.tsinghua.edu.cn/simple" \ | ||
ALPINE_MIRROR="mirrors.ustc.edu.cn" \ | ||
PUID=0 \ | ||
PGID=0 \ | ||
UMASK=000 \ | ||
WORKDIR="/nas-tools" | ||
WORKDIR ${WORKDIR} | ||
RUN mkdir ${HOME} \ | ||
&& addgroup -S nt -g 911 \ | ||
&& adduser -S nt -G nt -h ${HOME} -s /bin/bash -u 911 \ | ||
&& python_ver=$(python3 -V | awk '{print $2}') \ | ||
&& python_path=$(which python3) \ | ||
&& [ -d "/usr/lib/python${python_ver%.*}/site-packages" ] || mkdir -p "/usr/lib/python${python_ver%.*}/site-packages" \ | ||
&& echo "${WORKDIR}/" > /usr/lib/python${python_ver%.*}/site-packages/nas-tools.pth \ | ||
&& echo 'fs.inotify.max_user_watches=5242880' >> /etc/sysctl.conf \ | ||
&& echo 'fs.inotify.max_user_instances=5242880' >> /etc/sysctl.conf \ | ||
&& echo "nt ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \ | ||
&& git config --global pull.ff only \ | ||
&& git clone -b beta ${REPO_URL} ${WORKDIR} --depth=1 --recurse-submodule \ | ||
&& git config --global --add safe.directory ${WORKDIR} | ||
COPY --chmod=755 ./rootfs / | ||
EXPOSE 3000 | ||
VOLUME ["/config"] | ||
ENTRYPOINT [ "/init" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
FROM python:3.10.11-slim-bullseye | ||
COPY --from=shinsenter/s6-overlay / / | ||
RUN set -xe && \ | ||
export DEBIAN_FRONTEND="noninteractive" && \ | ||
apt-get update -y && \ | ||
apt-get install -y wget bash && \ | ||
apt-get install -y $(echo $(wget --no-check-certificate -qO- https://raw.githubusercontent.com/hsuyelin/nas-tools/beta/package_list_debian.txt)) && \ | ||
ln -sf /command/with-contenv /usr/bin/with-contenv && \ | ||
# zone time | ||
ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \ | ||
echo "${TZ}" > /etc/timezone && \ | ||
# locale | ||
locale-gen zh_CN.UTF-8 && \ | ||
# chromedriver | ||
ln -sf /usr/bin/chromedriver /usr/lib/chromium/chromedriver && \ | ||
# Python settings | ||
update-alternatives --install /usr/bin/python python /usr/local/bin/python3.10 3 && \ | ||
update-alternatives --install /usr/bin/python python /usr/bin/python3.9 2 && \ | ||
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3 && \ | ||
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2 && \ | ||
# Rclone | ||
curl https://rclone.org/install.sh | bash && \ | ||
# Minio | ||
if [ "$(uname -m)" = "x86_64" ]; then ARCH=amd64; elif [ "$(uname -m)" = "aarch64" ]; then ARCH=arm64; fi && \ | ||
curl https://dl.min.io/client/mc/release/linux-${ARCH}/mc --create-dirs -o /usr/bin/mc && \ | ||
chmod +x /usr/bin/mc && \ | ||
# Pip requirements prepare | ||
apt-get install -y build-essential && \ | ||
# Pip requirements | ||
pip install --upgrade pip setuptools wheel && \ | ||
pip install cython && \ | ||
pip install -r https://raw.githubusercontent.com/hsuyelin/nas-tools/beta/requirements.txt && \ | ||
# Clear | ||
apt-get remove -y build-essential && \ | ||
apt-get autoremove -y && \ | ||
apt-get clean -y && \ | ||
rm -rf \ | ||
/tmp/* \ | ||
/root/.cache \ | ||
/var/lib/apt/lists/* \ | ||
/var/tmp/* | ||
ENV S6_SERVICES_GRACETIME=30000 \ | ||
S6_KILL_GRACETIME=60000 \ | ||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ | ||
S6_SYNC_DISKS=1 \ | ||
HOME="/nt" \ | ||
TERM="xterm" \ | ||
PATH=${PATH}:/usr/lib/chromium:/command \ | ||
TZ="Asia/Shanghai" \ | ||
NASTOOL_CONFIG="/config/config.yaml" \ | ||
NASTOOL_AUTO_UPDATE=false \ | ||
NASTOOL_CN_UPDATE=true \ | ||
NASTOOL_VERSION=beta \ | ||
REPO_URL="https://github.com/hsuyelin/nas-tools.git" \ | ||
PYPI_MIRROR="https://pypi.tuna.tsinghua.edu.cn/simple" \ | ||
PUID=0 \ | ||
PGID=0 \ | ||
UMASK=000 \ | ||
WORKDIR="/nas-tools" | ||
WORKDIR ${WORKDIR} | ||
RUN set -xe \ | ||
&& mkdir ${HOME} \ | ||
&& groupadd -r nt -g 911 \ | ||
&& useradd -r nt -g nt -d ${HOME} -s /bin/bash -u 911 \ | ||
&& python_ver=$(python3 -V | awk '{print $2}') \ | ||
&& echo "${WORKDIR}/" > /usr/local/lib/python${python_ver%.*}/site-packages/nas-tools.pth \ | ||
&& echo 'fs.inotify.max_user_watches=5242880' >> /etc/sysctl.conf \ | ||
&& echo 'fs.inotify.max_user_instances=5242880' >> /etc/sysctl.conf \ | ||
&& echo "nt ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \ | ||
&& git config --global pull.ff only \ | ||
&& git clone -b beta ${REPO_URL} ${WORKDIR} --depth=1 --recurse-submodule \ | ||
&& git config --global --add safe.directory ${WORKDIR} | ||
COPY --chmod=755 ./rootfs / | ||
EXPOSE 3000 | ||
VOLUME [ "/config" ] | ||
ENTRYPOINT [ "/init" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
APP_VERSION = 'v3.4.0-beta' | ||
APP_VERSION = 'v3.4.0' |