Skip to content

Commit

Permalink
Add docker build environment
Browse files Browse the repository at this point in the history
refs #4
  • Loading branch information
mxhash committed Apr 12, 2019
1 parent ff880bb commit e080607
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
9 changes: 4 additions & 5 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)


0 comments on commit e080607

Please sign in to comment.