Skip to content

Commit d9acfc4

Browse files
committed
Kubernetes-dashboard: refactor Dockerfile for Trivy installation method
- Updated the Dockerfile to install Trivy using a script from the official repository, improving the installation process and reducing reliance on temporary files. - Removed the previous method of downloading and extracting the Trivy binary, streamlining the setup. Signed-off-by: NotHarshhaa <reddyharshhaa12@gmail.com>
1 parent 90e545b commit d9acfc4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ RUN apt-get update && apt-get install -y \
1919
&& rm -rf /var/lib/apt/lists/*
2020

2121
# Install Trivy for security scanning
22-
RUN wget -qO /tmp/trivy.tar.gz https://github.com/aquasecurity/trivy/releases/latest/download/trivy_linux_amd64.tar.gz \
23-
&& tar -xzf /tmp/trivy.tar.gz -C /tmp/ \
22+
RUN TRIVY_VERSION=$(curl -s https://api.github.com/repos/aquasecurity/trivy/releases/latest | grep '"tag_name":' | cut -d '"' -f 4) \
23+
&& wget -qO /tmp/trivy_${TRIVY_VERSION}_linux_amd64.tar.gz https://github.com/aquasecurity/trivy/releases/download/trivy_${TRIVY_VERSION}_linux_amd64.tar.gz \
24+
&& tar -xzf /tmp/trivy_${TRIVY_VERSION}_linux_amd64.tar.gz -C /tmp/ \
2425
&& mv /tmp/trivy /usr/local/bin/trivy \
2526
&& chmod +x /usr/local/bin/trivy \
26-
&& rm -f /tmp/trivy.tar.gz
27+
&& rm -f /tmp/trivy_${TRIVY_VERSION}_linux_amd64.tar.gz
2728

2829
# Copy requirements first for better caching
2930
COPY requirements.txt .

0 commit comments

Comments
 (0)