更新 dockerinfo/Dockerfile
This commit is contained in:
@@ -1,35 +1,90 @@
|
||||
# 使用Alpine Linux作为基础镜像
|
||||
FROM alpine:latest
|
||||
FROM ubuntu:latest
|
||||
|
||||
# 安装ADB、Bash、Curl以及OpenSSH服务
|
||||
RUN apk update && apk add --no-cache android-tools bash curl openssh libqrencode-tools \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
ARG VERSION
|
||||
ENV VERSION=$VERSION
|
||||
|
||||
# 配置SSH服务
|
||||
RUN echo "root:password" | chpasswd \
|
||||
LABEL org.opencontainers.image.title="tvhelper"
|
||||
LABEL org.opencontainers.image.version="${VERSION}"
|
||||
LABEL org.opencontainers.image.description="请挂载宿主目录到 /data 用于批量安装App"
|
||||
LABEL org.opencontainers.image.documentation="https://wkdaily.cpolar.cn/archives/tvhelper"
|
||||
LABEL org.opencontainers.image.source="https://github.com/wukongdaily/tvhelper-docker"
|
||||
LABEL org.opencontainers.image.authors="wukongdaily"
|
||||
|
||||
VOLUME ["/data"]
|
||||
ENV DATA_DIR=/data
|
||||
|
||||
# 安装依赖 + 配置环境
|
||||
RUN apt-get update && apt-get install -y \
|
||||
android-tools-adb bash curl openssh-server apache2 unzip \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& echo "VERSION=$VERSION" >> /etc/environment \
|
||||
&& echo "root:password" | chpasswd \
|
||||
&& ssh-keygen -A \
|
||||
&& echo "cd /tvhelper/shells" >> /root/.profile \
|
||||
&& echo 'export PATH="$PATH:/usr/lib/android-sdk/platform-tools"' >> /root/.profile
|
||||
&& echo 'export PATH="$PATH:/usr/lib/android-sdk/platform-tools"' >> /root/.profile \
|
||||
&& echo '# 自动加载 tv.sh 脚本(如果存在)' >> /root/.bashrc && \
|
||||
echo 'if [ -f /tvhelper/shells/tv.sh ]; then' >> /root/.bashrc && \
|
||||
echo ' echo "$(date) 正在执行 tv.sh 脚本..."' >> /root/.bashrc && \
|
||||
echo ' /tvhelper/shells/tv.sh' >> /root/.bashrc && \
|
||||
echo 'fi' >> /root/.bashrc \
|
||||
&& echo "PermitRootLogin yes" >> /etc/ssh/sshd_config \
|
||||
&& echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config \
|
||||
# 修改 SSH 端口为 2299
|
||||
&& sed -i 's/^#Port 22/Port 2299/' /etc/ssh/sshd_config
|
||||
|
||||
# 修改 Apache 监听端口为 2280
|
||||
RUN sed -i 's/^Listen 80/Listen 2280/' /etc/apache2/ports.conf
|
||||
|
||||
RUN git clone https://github.com/wukongdaily/tvhelper-docker.git /tvhelper
|
||||
# 正确生成 VirtualHost 配置
|
||||
RUN cat <<'EOF' > /etc/apache2/sites-available/000-default.conf
|
||||
<VirtualHost *:2280>
|
||||
ServerName localhost
|
||||
Redirect permanent / https://tvhelper.cpolar.cn/
|
||||
</VirtualHost>
|
||||
EOF
|
||||
|
||||
# 为 /tvhelper/shells 目录下所有.sh文件设置可执行权限
|
||||
# Apache 全局 ServerName
|
||||
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
||||
|
||||
# 安装 dufs(固定版本)
|
||||
ARG TARGETARCH
|
||||
ENV DUFS_VERSION=v0.44.0
|
||||
RUN set -eux; \
|
||||
case "$TARGETARCH" in \
|
||||
amd64) DUFS_ARCH="x86_64-unknown-linux-musl" ;; \
|
||||
arm64) DUFS_ARCH="aarch64-unknown-linux-musl" ;; \
|
||||
arm) DUFS_ARCH="armv7-unknown-linux-musleabihf" ;; \
|
||||
*) echo "❌ Unsupported arch: $TARGETARCH" && exit 1 ;; \
|
||||
esac; \
|
||||
curl -L "https://github.com/sigoden/dufs/releases/download/${DUFS_VERSION}/dufs-${DUFS_VERSION}-${DUFS_ARCH}.tar.gz" -o /tmp/dufs.tar.gz; \
|
||||
tar -xzf /tmp/dufs.tar.gz -C /usr/local/bin; \
|
||||
rm /tmp/dufs.tar.gz; \
|
||||
chmod +x /usr/local/bin/dufs
|
||||
|
||||
# 其余配置(保持不变)
|
||||
COPY tvhelper-docker /tvhelper
|
||||
RUN find /tvhelper/shells -type f -iname "*.sh" -exec chmod +x {} \;
|
||||
# 保留快捷键脚本 t
|
||||
COPY tvhelper-docker/shells/tv.sh /usr/local/bin/t
|
||||
RUN chmod +x /usr/local/bin/t
|
||||
|
||||
# 设置SSH服务以允许远程登录
|
||||
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
|
||||
&& sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
|
||||
RUN echo '\n# 自动执行 tv.sh(仅交互式 shell)' >> /root/.bashrc \
|
||||
&& echo 'if [[ $- == *i* ]] && [ -f /tvhelper/shells/tv.sh ]; then' >> /root/.bashrc \
|
||||
&& echo ' /tvhelper/shells/tv.sh' >> /root/.bashrc \
|
||||
&& echo 'fi' >> /root/.bashrc
|
||||
|
||||
# 开放22端口用于SSH连接
|
||||
EXPOSE 22
|
||||
RUN echo '\n# 自动执行 tv.sh(登录 shell)' >> /root/.profile \
|
||||
&& echo 'if [ -f /tvhelper/shells/tv.sh ]; then' >> /root/.profile \
|
||||
&& echo ' /tvhelper/shells/tv.sh' >> /root/.profile \
|
||||
&& echo 'fi' >> /root/.profile
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /tvhelper/shells
|
||||
|
||||
# 创建并设置启动脚本
|
||||
COPY start.sh /start.sh
|
||||
RUN chmod +x /start.sh
|
||||
|
||||
# 使用start.sh作为容器的启动命令
|
||||
CMD ["/start.sh"]
|
||||
# 暴露新端口
|
||||
EXPOSE 2299
|
||||
EXPOSE 2280
|
||||
EXPOSE 15000
|
||||
|
||||
CMD ["/start.sh"]
|
||||
Reference in New Issue
Block a user