Skip to content
This repository has been archived by the owner on Apr 5, 2019. It is now read-only.

Commit

Permalink
Witched to multi-stage building
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMcGrath committed Nov 15, 2017
1 parent 1575c8b commit 7a98deb
Showing 1 changed file with 31 additions and 16 deletions.
47 changes: 31 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
FROM node:6.10-alpine
### Alpine Driftnet Builder Image ###
FROM alpine:3.6 as builder

ENV PROJECT_PATH /driftnet
# Install the needed dependencies to build driftnet
RUN apk -U add --no-cache git build-base libpcap-dev

# Download the dldewolf fork of driftnet. We specifically want this version
# as it supports PNG files.
RUN git clone https://github.com/bldewolf/driftnet.git /driftnet

# We will need to make some modifications to the makefile so that we don't attempt
# to build with GTK. As we won't have any kind of a GUI to interface to, its quite
# silly to add all of that complexity. Once the modifications are complete, we will
# then build driftnet.
WORKDIR /driftnet
RUN sed -i 's/#CFLAGS += -DNO_DISPLAY_WINDOW/CFLAGS += -DNO_DISPLAY_WINDOW/g' Makefile
RUN sed -i 's/CFLAGS += `pkg-config --cflags gtk+-2.0` `pkg-config --cflags libpng`//g' Makefile
RUN sed -i 's/LDLIBS += -ljpeg -lgif `pkg-config --libs gtk+-2.0` `pkg-config --libs libpng`//g' Makefile
RUN make


### Dofler Driftnet Image ###
FROM node:9.1-alpine
ENV MONITOR_INTERFACE ""
ENV IMAGE_PATH "/images"
ENV DOFLER_ADDRESS ""

RUN apk add --update --no-cache git build-base libpcap libpcap-dev \
&& git clone https://github.com/bldewolf/driftnet.git /driftnet \
&& cd /driftnet \
&& sed -i 's/#CFLAGS += -DNO_DISPLAY_WINDOW/CFLAGS += -DNO_DISPLAY_WINDOW/g' Makefile \
&& sed -i 's/CFLAGS += `pkg-config --cflags gtk+-2.0` `pkg-config --cflags libpng`//g' Makefile \
&& sed -i 's/LDLIBS += -ljpeg -lgif `pkg-config --libs gtk+-2.0` `pkg-config --libs libpng`//g' Makefile \
&& make \
&& cp driftnet /usr/bin \
&& cd /app \
&& npm install \
&& mkdir -p /images \
&& rm -rf /driftnet \
&& apk del --no-cache git build-base

# install the dependencies from apk, pull in driftnet from the builder image,
# and then pull in the parser code.
RUN apk -U add --no-cache libpcap
COPY --from=builder /driftnet/driftnet /usr/bin/
COPY app /opt/app

# Install the needed dependencies from NPM
WORKDIR /opt/app
RUN npm install .

VOLUME /images

CMD ["node", "/opt/app/index.js"]

0 comments on commit 7a98deb

Please sign in to comment.