Update Dockerfile
Browse files- Dockerfile +10 -7
Dockerfile
CHANGED
|
@@ -2,7 +2,7 @@ FROM python:3.11.10-alpine3.20
|
|
| 2 |
LABEL maintainer='<author>'
|
| 3 |
LABEL version='0.0.0-dev.0-build.0'
|
| 4 |
|
| 5 |
-
#
|
| 6 |
RUN apk add --no-cache \
|
| 7 |
libc-dev \
|
| 8 |
libffi-dev \
|
|
@@ -10,24 +10,27 @@ RUN apk add --no-cache \
|
|
| 10 |
wget \
|
| 11 |
unzip
|
| 12 |
|
| 13 |
-
#
|
| 14 |
RUN set -e; \
|
| 15 |
DOWNLOAD_URL="https://codeload.github.com/crazypeace/huashengdun-webssh/zip/refs/heads/master"; \
|
| 16 |
-
|
| 17 |
-
wget "$DOWNLOAD_URL" -O /tmp/webssh.zip || (echo "Download failed. URL may be incorrect." && exit 1); \
|
| 18 |
unzip /tmp/webssh.zip -d /tmp && \
|
| 19 |
mv /tmp/huashengdun-webssh-master /code && \
|
| 20 |
rm /tmp/webssh.zip
|
| 21 |
|
| 22 |
WORKDIR /code
|
| 23 |
|
| 24 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
RUN pip install -r requirements.txt --no-cache-dir
|
| 26 |
|
| 27 |
-
#
|
| 28 |
RUN apk del gcc libc-dev libffi-dev wget unzip
|
| 29 |
|
| 30 |
-
#
|
| 31 |
RUN addgroup webssh && \
|
| 32 |
adduser -Ss /bin/false -g webssh webssh && \
|
| 33 |
chown -R webssh:webssh /code
|
|
|
|
| 2 |
LABEL maintainer='<author>'
|
| 3 |
LABEL version='0.0.0-dev.0-build.0'
|
| 4 |
|
| 5 |
+
# 安装必要包(包括构建依赖)
|
| 6 |
RUN apk add --no-cache \
|
| 7 |
libc-dev \
|
| 8 |
libffi-dev \
|
|
|
|
| 10 |
wget \
|
| 11 |
unzip
|
| 12 |
|
| 13 |
+
# 下载并解压GitHub仓库
|
| 14 |
RUN set -e; \
|
| 15 |
DOWNLOAD_URL="https://codeload.github.com/crazypeace/huashengdun-webssh/zip/refs/heads/master"; \
|
| 16 |
+
wget "$DOWNLOAD_URL" -O /tmp/webssh.zip && \
|
|
|
|
| 17 |
unzip /tmp/webssh.zip -d /tmp && \
|
| 18 |
mv /tmp/huashengdun-webssh-master /code && \
|
| 19 |
rm /tmp/webssh.zip
|
| 20 |
|
| 21 |
WORKDIR /code
|
| 22 |
|
| 23 |
+
# 复制requirements.txt并更新Paramiko版本
|
| 24 |
+
# 假设原requirements.txt包含paramiko,替换为以下内容或调整版本
|
| 25 |
+
RUN echo "paramiko>=3.0.0\ncryptography<42.0.0" > requirements.txt
|
| 26 |
+
|
| 27 |
+
# 安装Python依赖
|
| 28 |
RUN pip install -r requirements.txt --no-cache-dir
|
| 29 |
|
| 30 |
+
# 清理构建依赖
|
| 31 |
RUN apk del gcc libc-dev libffi-dev wget unzip
|
| 32 |
|
| 33 |
+
# 设置用户和权限
|
| 34 |
RUN addgroup webssh && \
|
| 35 |
adduser -Ss /bin/false -g webssh webssh && \
|
| 36 |
chown -R webssh:webssh /code
|