Skip to content

Commit

Permalink
fix: docker
Browse files Browse the repository at this point in the history
  • Loading branch information
linyuan0213 committed Apr 30, 2024
1 parent 1b8e956 commit a2ef877
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 625 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ jobs:
- name: Build Image
uses: docker/build-push-action@v2
with:
context: docker
file: docker/dev.Dockerfile
file: dev.Dockerfile
platforms: |
linux/amd64
linux/arm64
Expand Down
275 changes: 0 additions & 275 deletions .github/workflows/build-package.yml

This file was deleted.

File renamed without changes.
3 changes: 1 addition & 2 deletions app/plugins/modules/autosignin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import json
from datetime import datetime, timedelta
from multiprocessing.dummy import Pool as ThreadPool
from multiprocessing.pool import ThreadPool
from threading import Event
from urllib.parse import urlsplit

Expand All @@ -20,7 +19,7 @@
from app.plugins.modules._base import _IPluginModule
from app.sites.siteconf import SiteConf
from app.sites.sites import Sites
from app.utils import RequestUtils, ExceptionUtils, StringUtils, SchedulerUtils, JsonUtils
from app.utils import RequestUtils, ExceptionUtils, StringUtils, JsonUtils
from app.utils.types import EventType
from config import Config

Expand Down
19 changes: 9 additions & 10 deletions docker/dev.Dockerfile → dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
FROM alpine:3.17 AS Builder

COPY ./package_list.txt /tmp/
COPY ./requirements.txt /tmp/
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/linyuan0213/nas-tools/dev/package_list.txt)) \
&& apk add --no-cache $(cat /tmp/package_list.txt) \
&& ln -sf /usr/bin/python3 /usr/bin/python \
&& curl https://rclone.org/install.sh | bash \
&& if [ "$(uname -m)" = "x86_64" ]; then ARCH=amd64; elif [ "$(uname -m)" = "aarch64" ]; then ARCH=arm64; fi \
Expand All @@ -14,10 +17,10 @@ RUN apk add --no-cache --virtual .build-deps \
&& pip install --upgrade pip setuptools wheel \
&& pip install cython \
&& pip install gunicorn \
&& pip install -r https://raw.githubusercontent.com/linyuan0213/nas-tools/dev/requirements.txt \
&& pip install -r /tmp/requirements.txt \
&& apk del --purge .build-deps \
&& rm -rf /tmp/* /root/.cache /var/cache/apk/*
COPY --chmod=755 ./rootfs /
COPY --chmod=755 ./docker/rootfs /
FROM scratch AS APP
COPY --from=Builder / /
ENV S6_SERVICES_GRACETIME=30000 \
Expand All @@ -30,17 +33,17 @@ ENV S6_SERVICES_GRACETIME=30000 \
LANG="C.UTF-8" \
TZ="Asia/Shanghai" \
NASTOOL_CONFIG="/config/config.yaml" \
NASTOOL_AUTO_UPDATE=true \
NASTOOL_CN_UPDATE=true \
NASTOOL_VERSION=dev \
PS1="\u@\h:\w \$ " \
REPO_URL="https://github.com/linyuan0213/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"
RUN mkdir ${WORKDIR}
ADD ./ ${WORKDIR}/

WORKDIR ${WORKDIR}
RUN mkdir ${HOME} \
&& addgroup -S nt -g 911 \
Expand All @@ -50,10 +53,6 @@ RUN mkdir ${HOME} \
&& 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 dev ${REPO_URL} ${WORKDIR} --depth=1 --recurse-submodule \
&& git config --global --add safe.directory ${WORKDIR} \
&& chmod +x /nas-tools/docker/entrypoint.sh
EXPOSE 3000
VOLUME ["/config"]
ENTRYPOINT [ "/init" ]
Loading

0 comments on commit a2ef877

Please sign in to comment.