Skip to content

Commit e080607

Browse files
committed
Add docker build environment
refs #4
1 parent ff880bb commit e080607

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

.dockerignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Ignore all
2+
*
3+
.*
4+
5+
# Except what we need to build
6+
!/configure
7+
!/configure.ac
8+
!/install-sh
9+
!/Makefile.in
10+
!/snmp_bulkget.c
11+
!/snmp_bulkget.h
12+
!/utils.c
13+
!/utils.h

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM debian:stable-slim as builder
2+
WORKDIR /src
3+
ENV LANG="C.UTF-8"
4+
ENV TERM=xterm
5+
ARG target=""
6+
ONBUILD ENV DEBIAN_FRONTEND=noninteractive
7+
RUN apt-get update \
8+
&& apt-get install -y \
9+
build-essential \
10+
libsnmp-dev \
11+
&& rm -rf /var/lib/apt/lists/*
12+
COPY . .
13+
RUN ./configure --libexecdir=/src \
14+
&& make $target
15+
16+
FROM debian:stable-slim
17+
ONBUILD ENV DEBIAN_FRONTEND=noninteractive
18+
RUN apt-get update \
19+
&& apt-get install -y \
20+
libsnmp30 \
21+
&& rm -rf /var/lib/apt/lists/*
22+
COPY --from=0 /src/check_interfaces /check_interfaces
23+
24+
ENTRYPOINT ["/check_interfaces"]

Makefile.in

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ CFLAGS=@CFLAGS@ @DEFS@
1414
# DLFLAGS=-fPIC -shared
1515
BUILDLIBS=@SNMP_LIBS@ @LIBS@
1616

17-
.PHONY: debug clean all install
17+
.PHONY: debug clean distclean all install
1818
all: build strip
1919
build: $(TARGET)
2020

@@ -28,12 +28,11 @@ debug: CFLAGS += -DDEBUG -g -O0
2828
debug: LDFLAGS += -g -O0
2929
debug: build
3030

31-
3231
clean:
33-
rm $(OBJS) $(TARGET)
32+
rm -f $(OBJS) $(TARGET)
3433

34+
distclean: clean
35+
rm -f config.log config.status Makefile
3536

3637
install: all
3738
$(INSTALL) -t $(DESTDIR) $(TARGET)
38-
39-

0 commit comments

Comments
 (0)