2018-09-17 06:49:57 +00:00
|
|
|
FROM debian:stable-slim as python3-base
|
|
|
|
RUN apt-get update
|
|
|
|
RUN apt-get install --no-install-recommends -y libffi6 python3 python3-pip
|
|
|
|
RUN adduser --system --shell /bin/bash --group --disabled-password --no-create-home --home /cowrie cowrie
|
|
|
|
RUN mkdir -p /cowrie/var/lib/cowrie/downloads
|
|
|
|
RUN mkdir -p /cowrie/var/lib/cowrie/tty
|
|
|
|
RUN mkdir -p /cowrie/var/log/cowrie/
|
|
|
|
RUN chown -R cowrie:cowrie /cowrie
|
|
|
|
RUN chmod -R a+rX /cowrie
|
2018-08-06 08:27:32 +00:00
|
|
|
COPY requirements.txt .
|
2018-09-02 05:57:21 +00:00
|
|
|
COPY requirements-output.txt .
|
2018-08-06 08:27:32 +00:00
|
|
|
COPY honeyfs /cowrie/honeyfs
|
|
|
|
COPY share /cowrie/share
|
|
|
|
COPY etc /cowrie/etc
|
|
|
|
|
2018-09-17 06:49:57 +00:00
|
|
|
FROM python3-base as builder
|
|
|
|
RUN apt-get install --no-install-recommends -y python3-wheel python3-setuptools build-essential libssl-dev libffi-dev python3-dev libsnappy-dev default-libmysqlclient-dev
|
|
|
|
RUN pip3 wheel --wheel-dir=/root/wheelhouse -r requirements.txt
|
|
|
|
RUN pip3 wheel --wheel-dir=/root/wheelhouse -r requirements-output.txt
|
2018-08-06 08:27:32 +00:00
|
|
|
|
2018-09-17 06:49:57 +00:00
|
|
|
FROM python3-base as post-builder
|
2018-08-06 08:27:32 +00:00
|
|
|
COPY --from=builder /root/wheelhouse /root/wheelhouse
|
2018-09-17 06:49:57 +00:00
|
|
|
RUN pip3 install -r requirements.txt --no-index --find-links=/root/wheelhouse
|
|
|
|
RUN pip3 install -r requirements-output.txt --no-index --find-links=/root/wheelhouse
|
2018-09-06 12:35:37 +00:00
|
|
|
|
|
|
|
FROM post-builder as pre-devel
|
2018-09-17 06:49:57 +00:00
|
|
|
RUN pip3 install flake8 flake8-import-order pytest
|
2018-08-06 08:27:32 +00:00
|
|
|
|
2018-09-06 12:35:37 +00:00
|
|
|
FROM pre-devel as devel
|
|
|
|
USER cowrie
|
2018-08-06 08:27:32 +00:00
|
|
|
|
2018-09-06 12:35:37 +00:00
|
|
|
FROM pre-devel as tests
|
|
|
|
COPY src /cowrie
|
2018-08-06 08:27:32 +00:00
|
|
|
ENV PYTHONPATH=/cowrie
|
|
|
|
WORKDIR /cowrie
|
2018-09-06 12:35:37 +00:00
|
|
|
RUN flake8 --count --application-import-names cowrie --max-line-length=120 --statistics . && \
|
|
|
|
trial cowrie
|
|
|
|
|
|
|
|
FROM post-builder as pre-release
|
2018-09-17 06:49:57 +00:00
|
|
|
RUN apt-get remove -y python3-pip && \
|
2018-09-06 12:35:37 +00:00
|
|
|
apt-get autoremove -y && \
|
|
|
|
apt-get autoclean -y && \
|
|
|
|
rm -rf /root/wheelhouse && \
|
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
|
|
rm -rf /var/log/*
|
|
|
|
COPY src /cowrie
|
2018-09-06 15:36:08 +00:00
|
|
|
RUN find /cowrie -type d -exec chmod 755 {} \; && \
|
|
|
|
find /cowrie -type f -exec chmod 744 {} \;
|
2018-08-06 08:27:32 +00:00
|
|
|
|
2018-09-06 12:35:37 +00:00
|
|
|
FROM pre-release as release
|
2018-09-02 05:57:21 +00:00
|
|
|
LABEL maintainer="Florian Pelgrim <florian.pelgrim@craneworks.de>"
|
2018-08-06 08:27:32 +00:00
|
|
|
ENV PYTHONPATH=/cowrie
|
|
|
|
WORKDIR /cowrie
|
|
|
|
EXPOSE 2222/tcp
|
|
|
|
EXPOSE 2223/tcp
|
|
|
|
USER cowrie
|
2018-09-17 06:49:57 +00:00
|
|
|
CMD /usr/bin/python3 /usr/local/bin/twistd --umask 0022 --nodaemon --pidfile= -l - cowrie
|