Browse Source

调整dockerfile

develop
H Vs 1 day ago
parent
commit
60edc1f2b8
3 changed files with 70 additions and 21 deletions
  1. +3
    -21
      docker/Dockerfile.latest
  2. +50
    -0
      docker/Dockerfile.latest.bk
  3. +17
    -0
      docker/python.Dockerfile

+ 3
- 21
docker/Dockerfile.latest View File

@@ -1,4 +1,5 @@
FROM python:3.10-slim-bullseye
#FROM python:3.10-slim-bullseye
FROM 139.224.254.18:5000/ssjl/python:3.10-slim-bullseye

LABEL maintainer="foo@bar.com"
ARG TZ='Asia/Shanghai'
@@ -7,30 +8,11 @@ ARG TZ='Asia/Shanghai'
#RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list


# Set the timezone and configure tzdata
# RUN apt-get update \
# && apt-get install -y --no-install-recommends tzdata \
# && ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
# && dpkg-reconfigure --frontend noninteractive tzdata \
# && apt-get clean


# RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime

RUN apt-get install -y --no-install-recommends tzdata \
&& ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& apt-get clean


ENV BUILD_PREFIX=/app

ADD . ${BUILD_PREFIX}

RUN apt-get update \
&&apt-get install -y --no-install-recommends bash ffmpeg espeak libavcodec-extra\
&& cd ${BUILD_PREFIX} \
RUN cd ${BUILD_PREFIX} \
&& cp config-template.json config.json \
&& /usr/local/bin/python -m pip install --no-cache --upgrade pip \
&& pip install --no-cache -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/


+ 50
- 0
docker/Dockerfile.latest.bk View File

@@ -0,0 +1,50 @@
FROM python:3.10-slim-bullseye

LABEL maintainer="foo@bar.com"
ARG TZ='Asia/Shanghai'

# RUN echo /etc/apt/sources.list
#RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list


# Set the timezone and configure tzdata
# RUN apt-get update \
# && apt-get install -y --no-install-recommends tzdata \
# && ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
# && dpkg-reconfigure --frontend noninteractive tzdata \
# && apt-get clean


# RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime

RUN apt-get install -y --no-install-recommends tzdata \
&& ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& apt-get clean


ENV BUILD_PREFIX=/app

ADD . ${BUILD_PREFIX}

RUN apt-get update \
&& apt-get install -y --no-install-recommends bash ffmpeg espeak libavcodec-extra\
&& cd ${BUILD_PREFIX} \
&& cp config-template.json config.json \
&& /usr/local/bin/python -m pip install --no-cache --upgrade pip \
&& pip install --no-cache -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
WORKDIR ${BUILD_PREFIX}

ADD docker/entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh \
&& mkdir -p /home/noroot \
&& groupadd -r noroot \
&& useradd -r -g noroot -s /bin/bash -d /home/noroot noroot \
&& chown -R noroot:noroot /home/noroot ${BUILD_PREFIX} /usr/local/lib

USER noroot

ENTRYPOINT ["/entrypoint.sh"]

+ 17
- 0
docker/python.Dockerfile View File

@@ -0,0 +1,17 @@
FROM python:3.10-slim-bullseye

LABEL maintainer="foo@bar.com"
ARG TZ='Asia/Shanghai'

# RUN echo /etc/apt/sources.list
# RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list


# Set the timezone and configure tzdata
RUN apt-get update \
&& apt-get install -y --no-install-recommends bash ffmpeg espeak libavcodec-extra \
&& apt-get install -y --no-install-recommends tzdata \
&& ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& apt-get clean

Loading…
Cancel
Save