Skip to content

Commit 6b67006

Browse files
Remove redundant apk update in Dockerfiles (cc #5016) (#9055)
The `apk` commands can utilize the `--no-cache` option, making the `update` step superfluous and ensuring the latest packages are used without maintaining a local cache. An additional `apk update` in the Dockerfile will just make the image larger with no benefits.
1 parent ff3a683 commit 6b67006

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

Dockerfile

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ WORKDIR /app
1212
USER root
1313

1414
# Install build dependencies
15-
RUN apk update && \
16-
apk add --no-cache gcc python3-dev openssl openssl-dev
15+
RUN apk add --no-cache gcc python3-dev openssl openssl-dev
1716

1817

1918
RUN pip install --upgrade pip && \
@@ -52,8 +51,7 @@ FROM $LITELLM_RUNTIME_IMAGE AS runtime
5251
USER root
5352

5453
# Install runtime dependencies
55-
RUN apk update && \
56-
apk add --no-cache openssl
54+
RUN apk add --no-cache openssl
5755

5856
WORKDIR /app
5957
# Copy the current directory contents into the container at /app

docker/Dockerfile.alpine

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ RUN pip wheel --no-cache-dir --wheel-dir=/wheels/ -r requirements.txt
3535
FROM $LITELLM_RUNTIME_IMAGE AS runtime
3636

3737
# Update dependencies and clean up
38-
RUN apk update && apk upgrade && rm -rf /var/cache/apk/*
38+
RUN apk upgrade --no-cache
3939

4040
WORKDIR /app
4141

docker/Dockerfile.database

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ WORKDIR /app
1212
USER root
1313

1414
# Install build dependencies
15-
RUN apk update && \
16-
apk add --no-cache gcc python3-dev openssl openssl-dev
15+
RUN apk add --no-cache gcc python3-dev openssl openssl-dev
1716

1817

1918
RUN pip install --upgrade pip && \
@@ -44,8 +43,7 @@ FROM $LITELLM_RUNTIME_IMAGE AS runtime
4443
USER root
4544

4645
# Install runtime dependencies
47-
RUN apk update && \
48-
apk add --no-cache openssl
46+
RUN apk add --no-cache openssl
4947

5048
WORKDIR /app
5149
# Copy the current directory contents into the container at /app

0 commit comments

Comments
 (0)