From e080607d560516f9fe5c0ba20b5729fe8d9755b3 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Fri, 12 Apr 2019 11:42:38 +0200 Subject: [PATCH] Add docker build environment refs #4 --- .dockerignore | 13 +++++++++++++ Dockerfile | 24 ++++++++++++++++++++++++ Makefile.in | 9 ++++----- 3 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ee731c9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +# Ignore all +* +.* + +# Except what we need to build +!/configure +!/configure.ac +!/install-sh +!/Makefile.in +!/snmp_bulkget.c +!/snmp_bulkget.h +!/utils.c +!/utils.h diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e1f31ee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM debian:stable-slim as builder +WORKDIR /src +ENV LANG="C.UTF-8" +ENV TERM=xterm +ARG target="" +ONBUILD ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get install -y \ + build-essential \ + libsnmp-dev \ + && rm -rf /var/lib/apt/lists/* +COPY . . +RUN ./configure --libexecdir=/src \ + && make $target + +FROM debian:stable-slim +ONBUILD ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get install -y \ + libsnmp30 \ + && rm -rf /var/lib/apt/lists/* +COPY --from=0 /src/check_interfaces /check_interfaces + +ENTRYPOINT ["/check_interfaces"] diff --git a/Makefile.in b/Makefile.in index ccea198..acf863d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -14,7 +14,7 @@ CFLAGS=@CFLAGS@ @DEFS@ # DLFLAGS=-fPIC -shared BUILDLIBS=@SNMP_LIBS@ @LIBS@ -.PHONY: debug clean all install +.PHONY: debug clean distclean all install all: build strip build: $(TARGET) @@ -28,12 +28,11 @@ debug: CFLAGS += -DDEBUG -g -O0 debug: LDFLAGS += -g -O0 debug: build - clean: - rm $(OBJS) $(TARGET) + rm -f $(OBJS) $(TARGET) +distclean: clean + rm -f config.log config.status Makefile install: all $(INSTALL) -t $(DESTDIR) $(TARGET) - -