Prechádzať zdrojové kódy

修改docker镜像构建

liyan 8 mesiacov pred
rodič
commit
4eb74e113a
2 zmenil súbory, kde vykonal 6 pridanie a 6 odobranie
  1. 4 4
      docker/Dockerfile
  2. 2 2
      docker/build.sh

+ 4 - 4
docker/Dockerfile

@@ -1,15 +1,15 @@
-FROM python:3.12-alpine
+FROM python:3.12-slim
 
 WORKDIR /usr/src/app
 
 COPY docker/debian.sources /etc/apt/sources.list.d
 
-COPY watermark_generate .
+COPY watermark_generate ./watermark_generate
 
 RUN apt-get update &&  \
-    apt-get install libgl1 -y && \
+    apt-get install libglib2.0-0 libgl1 -y && \
     pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn --default-timeout=60 --no-cache-dir -r ./watermark_generate/requirements.txt
 
 EXPOSE 5000
 
-CMD ["python", "run.py"]
+ENTRYPOINT ["python", "./watermark_generate/run.py"]

+ 2 - 2
docker/build.sh

@@ -1,10 +1,10 @@
 #!/bin/bash
 
 # 构建镜像
-docker docker build -t model_watermark_generate -f Dockerfile ..
+docker build -t model_watermark_generate -f Dockerfile ..
 
 # 运行容器
-docker run -d -p 5000:5000 --name watermark_container model_watermark_generate
+docker run -d -p 8888:5000 --name watermark_container model_watermark_generate
 
 # 导出镜像
 docker save -o model_watermark_generate.tar model_watermark_generate