File: Dockerfile

package info (click to toggle)
binwalk 2.3.1%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,040 kB
  • sloc: python: 5,636; sh: 239; makefile: 17
file content (48 lines) | stat: -rw-r--r-- 1,653 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
FROM python:3-buster AS build-and-install

ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/src/app/bin \
    DEBIAN_FRONTEND=noninteractive

COPY . /tmp
WORKDIR /tmp

### Took out the deps.sh from binwalk's installation script, baked in the dependencies into the main prereqs installation
### The prereqs that dont come from system's repo, are taken care of later
RUN set -xue \
    && apt-get update -qy \
    && apt-get -t buster dist-upgrade -yq --no-install-recommends -o Dpkg::Options::="--force-confold" \
    && ./deps.sh --yes \
    && python3 setup.py install && binwalk -h > /dev/null \
    && apt-get -yq purge *-dev git build-essential gcc g++ \
    && apt-get -y autoremove \
    && apt-get -y autoclean \
    && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
    && echo "LANG=en_US.UTF-8" >> /etc/default/locale \
    && echo "LANGUAGE=en_US:en" >> /etc/default/locale \
    && echo "LC_ALL=en_US.UTF-8" >> /etc/default/locale \
    && locale-gen

FROM build-and-install AS unit-tests
RUN pip install coverage nose \
    && python3 setup.py test \
    && dd if=/dev/urandom of=/tmp/random.bin bs=1M count=1 && binwalk -J -E /tmp/random.bin

FROM build-and-install AS cleanup-and-release
RUN useradd -m -u 1000 -s /sbin/nologin appuser \
    && rm -rf -- \
        /var/lib/apt/lists/* \
        /tmp/* /var/tmp/* \
        /root/.cache/pip

# Setup locale. This prevents Python 3 IO encoding issues.
ENV DEBIAN_FRONTEND=teletype \
    LANG=en_US.UTF-8 \
    LANGUAGE=en_US:en \
    LC_ALL=en_US.UTF-8 \
    PYTHONUTF8="1" \
    PYTHONHASHSEED="random"

WORKDIR /home/appuser
USER appuser

ENTRYPOINT ["binwalk"]