Skip to content

Commit

Permalink
Merge pull request #1539 from p-l-/docker-new-deb-stable
Browse files Browse the repository at this point in the history
Docker: new debian:stable base image
  • Loading branch information
p-l- committed Jun 20, 2023
2 parents a73ed7b + abfe26a commit 1c90dc9
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 90 deletions.
7 changes: 3 additions & 4 deletions doc/install/docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ that, from the ``docker/`` directory, run:

::

$ docker pull debian:stable
$ docker pull debian:buster
$ docker pull debian:12
$ for img in base client agent web web-doku web-uwsgi ; do
> docker build -t "ivre/$img" "$img"
> done
Expand All @@ -102,7 +101,7 @@ run:
$ tmp=`mktemp | sed 's#^/##'`; python setup.py --version | tr -d '\n' > "/$tmp"
$ tar rf docker/base-local/ivre.tar --transform="s#$tmp#ivre/ivre/VERSION#" /$tmp
$ rm "/$tmp"
$ docker pull debian:stable
$ docker pull debian:12
$ docker build -t ivre/base docker/base-local

Using pip
Expand All @@ -114,7 +113,7 @@ Another way to create the ``ivre/base`` image is to use

::

$ docker pull debian:stable
$ docker pull debian:12
$ docker build -t ivre/base base-pip

Initialization
Expand Down
23 changes: 10 additions & 13 deletions docker/base-local/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is part of IVRE.
# Copyright 2011 - 2022 Pierre LALET <pierre@droids-corp.org>
# Copyright 2011 - 2023 Pierre LALET <pierre@droids-corp.org>
#
# IVRE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
Expand All @@ -14,25 +14,22 @@
# You should have received a copy of the GNU General Public License
# along with IVRE. If not, see <http://www.gnu.org/licenses/>.

FROM debian:stable
FROM debian:12
LABEL maintainer="Pierre LALET <pierre@droids-corp.org>"

ENV DEBIAN_FRONTEND noninteractive

# Dependencies
RUN echo "deb http://deb.debian.org/debian stable-backports main" >> /etc/apt/sources.list
# Install pip, install IVRE, uninstall pip
ADD ivre.tar ./
RUN apt-get -q update && \
apt-get -qy --no-install-recommends install python3-pymongo python3-cryptography \
python3-setuptools python3-bottle python3-openssl ca-certificates && \
apt-get -qy --no-install-recommends install python3 python3-dev python3-pip python3-setuptools && \
pip3 install --break-system-packages /ivre && \
rm -rf /ivre && \
apt-get -qy autoremove python3-dev python3-pip python3-setuptools && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# IVRE
ADD ivre.tar ./
RUN cd ivre/ && \
python3 setup.py build && python3 setup.py install && \
cd ../ && rm -rf ivre/

# Fix version
RUN sed -ri 's#(VERSION = .*)(['\''"])$#\1-docker\2#' /usr/local/lib/python*/dist-packages/ivre/__init__.py
RUN sed -ri 's#$#-docker#' /usr/local/lib/python*/dist-packages/ivre/VERSION && \
sed -ri 's#(VERSION = .*)(['\''"])$#\1-docker\2#' /usr/local/lib/python*/dist-packages/ivre/__init__.py

RUN echo 'DB = "mongodb://ivredb/"' > /etc/ivre.conf
33 changes: 0 additions & 33 deletions docker/base-pip/Dockerfile

This file was deleted.

20 changes: 5 additions & 15 deletions docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,18 @@
# You should have received a copy of the GNU General Public License
# along with IVRE. If not, see <http://www.gnu.org/licenses/>.

FROM debian:stable
FROM debian:12
LABEL maintainer="Pierre LALET <pierre@droids-corp.org>"

ENV DEBIAN_FRONTEND noninteractive

# Dependencies
RUN echo "deb http://deb.debian.org/debian stable-backports main" >> /etc/apt/sources.list
# Install pip, get IVRE, uninstall pip
RUN apt-get -q update && \
apt-get -qy --no-install-recommends install python3-pymongo python3-cryptography \
python3-setuptools python3-bottle python3-openssl ca-certificates && \
apt-get -qy --no-install-recommends install python3 python3-dev python3-pip python3-setuptools git && \
pip3 install --break-system-packages git+https://github.com/ivre/ivre && \
apt-get -qy autoremove python3-dev python3-pip python3-setuptools git && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# IVRE
RUN apt-get -q update && \
apt-get -qy --no-install-recommends install git && \
git clone https://github.com/ivre/ivre && \
cd ivre/ && \
python3 setup.py build && python3 setup.py install && \
apt-get -qy --purge autoremove git && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
cd ../ && rm -rf ivre/

# Fix version
RUN sed -ri 's#$#-docker#' /usr/local/lib/python*/dist-packages/ivre/VERSION && \
sed -ri 's#(VERSION = .*)(['\''"])$#\1-docker\2#' /usr/local/lib/python*/dist-packages/ivre/__init__.py
Expand Down
10 changes: 5 additions & 5 deletions docker/client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LABEL maintainer="Pierre LALET <pierre@droids-corp.org>"

# Tools
## non-free: s3270
RUN sed -i 's/ main/ main non-free/' /etc/apt/sources.list
RUN sed -i 's/ main/ main non-free/' /etc/apt/sources.list.d/debian.sources
## openssl: IVRE depends on openssl exec + libssl needed for Nmap
## libfreetype6 libfontconfig1 fonts-dejavu: screenshots w/ phantomjs
RUN apt-get -q update && \
Expand All @@ -30,7 +30,7 @@ RUN apt-get -q update && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# Install Nmap using the official RPM package.
ADD https://nmap.org/dist/nmap-7.92-1.x86_64.rpm ./nmap.rpm
ADD https://nmap.org/dist/nmap-7.94-1.x86_64.rpm ./nmap.rpm
RUN apt-get -q update && \
apt-get -qy --no-install-recommends install alien && \
alien ./nmap.rpm && \
Expand All @@ -39,11 +39,11 @@ RUN apt-get -q update && \
apt-get -qy --purge autoremove alien && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# Install Zeek
# Install Zeek - Debian Testing because Debian_12 does not exist for now
RUN apt-get -q update && \
apt-get -qy --no-install-recommends install gnupg wget && \
echo 'deb http://download.opensuse.org/repositories/security:/zeek/Debian_11/ /' > /etc/apt/sources.list.d/zeek.list && \
wget -qO - https://download.opensuse.org/repositories/security:zeek/Debian_11/Release.key | apt-key add - && \
echo 'deb http://download.opensuse.org/repositories/security:/zeek/Debian_Testing/ /' > /etc/apt/sources.list.d/zeek.list && \
wget -qO - https://download.opensuse.org/repositories/security:zeek/Debian_Testing/Release.key | gpg --dearmor > /etc/apt/trusted.gpg.d/security_zeek.gpg && \
apt-get -q update && apt-get -qy --no-install-recommends install zeek && \
apt-get -qy --purge autoremove gnupg wget && \
apt-get clean && rm -rf /var/lib/apt/lists/*
Expand Down
10 changes: 6 additions & 4 deletions docker/web-doku/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with IVRE. If not, see <http://www.gnu.org/licenses/>.

FROM debian:stable
ARG TAG=latest
FROM ivre/base:${TAG} AS base

FROM debian:12
LABEL maintainer="Pierre LALET <pierre@droids-corp.org>"

RUN apt-get -q update && \
Expand All @@ -31,8 +33,8 @@ RUN apt-get -q update && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# IVRE-specific
COPY --from=ivre/base /usr/local/share/ivre/dokuwiki/media/logo.png /var/www/dokuwiki/data/media/wiki/logo.png
COPY --from=ivre/base /usr/local/share/ivre/patches/dokuwiki/backlinks.patch /tmp/backlinks.patch
COPY --from=base /usr/local/share/ivre/dokuwiki/media/logo.png /var/www/dokuwiki/data/media/wiki/logo.png
COPY --from=base /usr/local/share/ivre/patches/dokuwiki/backlinks.patch /tmp/backlinks.patch
RUN apt-get -q update && \
apt-get -qy --no-install-recommends install patch && \
(cd var/www/dokuwiki/ && patch -p0 < /tmp/backlinks.patch) && \
Expand Down Expand Up @@ -64,4 +66,4 @@ CMD [ -d "/var/www/dokuwiki/data/media/wiki" ] || (\
) && \
mkdir -p /run/php && \
chown -Rh www-data:www-data /var/www/dokuwiki/data && \
/usr/sbin/php-fpm7.4 -F
/usr/sbin/php-fpm -F
7 changes: 5 additions & 2 deletions docker/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@
# You should have received a copy of the GNU General Public License
# along with IVRE. If not, see <http://www.gnu.org/licenses/>.

FROM debian:stable
ARG TAG=latest
FROM ivre/base:${TAG} AS base

FROM debian:12
LABEL maintainer="Pierre LALET <pierre@droids-corp.org>"

RUN apt-get -q update && \
apt-get -qy --no-install-recommends install nginx && \
apt-get clean && rm -rf /var/lib/apt/lists/*
COPY nginx-default-site /etc/nginx/sites-available/default

COPY --from=ivre/base /usr/local/share/ivre/web/static /usr/local/share/ivre/web/static
COPY --from=base /usr/local/share/ivre/web/static /usr/local/share/ivre/web/static

RUN mkdir -p /var/www/dokuwiki/ && \
ln -sf /var/www/dokuwiki/data/lib /var/www/dokuwiki/
Expand Down
6 changes: 3 additions & 3 deletions ivre/tools/iphost.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ def main() -> None:
if db.passive is not None:
if args.passive_direct:
resolvers.append(
lambda value: db.passive.getdns(value, subdomains=args.sub), # type: ignore
lambda value: db.passive.getdns(value, subdomains=args.sub),
)
if args.passive_reverse:
resolvers.append(
lambda value: db.passive.getdns( # type: ignore
lambda value: db.passive.getdns(
value, subdomains=args.sub, reverse=True
)
)
if db.nmap is not None and args.nmap:
resolvers.append(lambda value: db.nmap.getdns(value, subdomains=args.sub)) # type: ignore
resolvers.append(lambda value: db.nmap.getdns(value, subdomains=args.sub))

for addr_or_name in args.names_or_addresses:
addr_or_name = str2regexp(addr_or_name)
Expand Down
3 changes: 1 addition & 2 deletions pkg/builddockers
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with IVRE. If not, see <http://www.gnu.org/licenses/>.

docker pull debian:stable
docker pull debian:buster
docker pull debian:12

# Create ivre/VERSION if needed
VERSION="$(python3 setup.py --version 2>/dev/null)"
Expand Down
7 changes: 3 additions & 4 deletions web/static/doc/_sources/install/docker.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ that, from the ``docker/`` directory, run:

::

$ docker pull debian:stable
$ docker pull debian:buster
$ docker pull debian:12
$ for img in base client agent web web-doku web-uwsgi ; do
> docker build -t "ivre/$img" "$img"
> done
Expand All @@ -102,7 +101,7 @@ run:
$ tmp=`mktemp | sed 's#^/##'`; python setup.py --version | tr -d '\n' > "/$tmp"
$ tar rf docker/base-local/ivre.tar --transform="s#$tmp#ivre/ivre/VERSION#" /$tmp
$ rm "/$tmp"
$ docker pull debian:stable
$ docker pull debian:12
$ docker build -t ivre/base docker/base-local

Using pip
Expand All @@ -114,7 +113,7 @@ Another way to create the ``ivre/base`` image is to use

::

$ docker pull debian:stable
$ docker pull debian:12
$ docker build -t ivre/base base-pip

Initialization
Expand Down
7 changes: 3 additions & 4 deletions web/static/doc/install/docker.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ <h2>Build the images<a class="headerlink" href="#build-the-images" title="Permal
<p>By default, the images will be downloaded from the Docker Hub. But you
also can build the images from the provided <code class="docutils literal notranslate"><span class="pre">Dockerfile</span></code>s. For
that, from the <code class="docutils literal notranslate"><span class="pre">docker/</span></code> directory, run:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ docker pull debian:stable
$ docker pull debian:buster
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ docker pull debian:12
$ for img in base client agent web web-doku web-uwsgi ; do
&gt; docker build -t &quot;ivre/$img&quot; &quot;$img&quot;
&gt; done
Expand All @@ -185,7 +184,7 @@ <h4>Local archive<a class="headerlink" href="#local-archive" title="Permalink to
$ tmp=`mktemp | sed &#39;s#^/##&#39;`; python setup.py --version | tr -d &#39;\n&#39; &gt; &quot;/$tmp&quot;
$ tar rf docker/base-local/ivre.tar --transform=&quot;s#$tmp#ivre/ivre/VERSION#&quot; /$tmp
$ rm &quot;/$tmp&quot;
$ docker pull debian:stable
$ docker pull debian:12
$ docker build -t ivre/base docker/base-local
</pre></div>
</div>
Expand All @@ -195,7 +194,7 @@ <h4>Using pip<a class="headerlink" href="#using-pip" title="Permalink to this he
<p>Another way to create the <code class="docutils literal notranslate"><span class="pre">ivre/base</span></code> image is to use
<a class="reference external" href="https://pypi.python.org/pypi/pip">pip</a>. From the
<code class="docutils literal notranslate"><span class="pre">docker/</span></code> directory, run:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ docker pull debian:stable
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ docker pull debian:12
$ docker build -t ivre/base base-pip
</pre></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/static/doc/searchindex.js

Large diffs are not rendered by default.

0 comments on commit 1c90dc9

Please sign in to comment.