Skip to content

Commit

Permalink
Update Dockerfile, use no install recommends and replace cd with work…
Browse files Browse the repository at this point in the history
…dir and remove pytest manuall install
  • Loading branch information
r4ulcl committed Mar 9, 2024
1 parent 8bfe80e commit 64a52c0
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,35 @@ FROM ubuntu:22.04 as hcxtools-builder
WORKDIR /app

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install python3-pip make git zlib1g-dev -y \
&& apt-get install pkg-config libcurl4-openssl-dev libssl-dev zlib1g-dev make gcc -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends python3-pip make git zlib1g-dev -y \
&& apt-get install --no-install-recommends pkg-config libcurl4-openssl-dev libssl-dev zlib1g-dev make gcc -y \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Clone hcxtools and install
RUN git clone -b 6.3.1 https://github.com/ZerBea/hcxtools.git /app/hcxtools \
&& cd /app/hcxtools \
&& make \
&& make install \
&& cd /app \
&& rm -rf /app/hcxtools
RUN git clone -b 6.3.1 https://github.com/ZerBea/hcxtools.git /app/hcxtools

WORKDIR /app/hcxtools
RUN make \
&& make install

WORKDIR /app
RUN rm -rf /app/hcxtools

FROM ubuntu:22.04

WORKDIR /app

# Install dependencies
ENV DEBIAN_FRONTEND noninteractive
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get update && apt-get install -y --no-install-recommends python3-pip tshark git libcurl4-openssl-dev libssl-dev -y \
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get update && apt-get install --no-install-recommends -y --no-install-recommends python3-pip tshark git libcurl4-openssl-dev libssl-dev -y \

Check warning on line 27 in Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Dockerfile#L27

Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Copy hcxtools binaries
COPY --from=hcxtools-builder /usr/bin/hcx* /usr/bin/


# Copy and install Python dependencies
RUN python3 -m pip install --no-cache-dir -U pip \
&& python3 -m pip install --no-cache-dir pytest
RUN python3 -m pip install --no-cache-dir -U pip

Check warning on line 35 in Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Dockerfile#L35

Pin versions in pip. Instead of `pip install <package>` use `pip install <package>==<version>`

COPY requirements.txt requirements.txt
RUN pip3 install --no-cache-dir -r requirements.txt
Expand Down

0 comments on commit 64a52c0

Please sign in to comment.