Skip to content

Commit 1275072

Browse files
authored
Merge pull request #34 from DingtangSun0813/main
Update Dockerfile to reduce image size
2 parents a67ac7e + dfc05df commit 1275072

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ ARG VERSION=0.0.0
1818
ENV SETUPTOOLS_SCM_PRETEND_VERSION=${VERSION}
1919

2020
RUN pip install --no-cache-dir --upgrade pip \
21-
&& pip install --no-cache-dir --prefix /install .[web]
21+
&& pip install --no-cache-dir --prefix /install .[web] \
22+
&& find /install -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true \
23+
&& find /install -type f -name '*.pyc' -delete \
24+
&& find /install -type f -name '*.pyo' -delete \
25+
&& find /install -type d -name 'tests' -exec rm -rf {} + 2>/dev/null || true \
26+
&& find /install -type d -name 'test' -exec rm -rf {} + 2>/dev/null || true \
27+
&& find /install -name '*.dist-info' -type d -exec sh -c 'rm -f "$1"/RECORD "$1"/INSTALLER' sh {} \; 2>/dev/null || true
2228

2329
FROM python:3.11-slim
2430

@@ -30,9 +36,8 @@ WORKDIR /app
3036

3137
RUN apt-get update \
3238
&& apt-get install -y --no-install-recommends ffmpeg \
33-
&& rm -rf /var/lib/apt/lists/*
34-
35-
RUN useradd --create-home --shell /usr/sbin/nologin ttsfm
39+
&& rm -rf /var/lib/apt/lists/* \
40+
&& useradd --create-home --shell /usr/sbin/nologin ttsfm
3641

3742
COPY --from=builder /install /usr/local
3843
ENV PATH="/usr/local/bin:$PATH"

0 commit comments

Comments
 (0)