forked from gosnmp/gosnmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (38 loc) · 1.07 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
FROM golang:1.16-alpine3.13
# Install deps
RUN apk add --no-cache \
bash \
curl \
gcc \
libc-dev \
make \
net-snmp \
net-snmp-tools \
openssl-dev \
python3 \
py3-pip \
vim
# add new user
RUN addgroup -g 1001 \
-S gosnmp; \
adduser -u 1001 -D -S \
-s /bin/bash \
-h /home/gosnmp \
-G gosnmp gosnmp
RUN chmod -R a+rw /etc/snmp /var/lib/net-snmp/
RUN pip install snmpsim
# Copy local branch into container
USER gosnmp
WORKDIR /go/src/github.com/gosnmp/gosnmp
COPY --chown=gosnmp . .
RUN go get github.com/stretchr/testify/assert && \
make tools && \
make lint
ENV GOSNMP_TARGET=127.0.0.1
ENV GOSNMP_PORT=1024
ENV GOSNMP_TARGET_IPV4=127.0.0.1
ENV GOSNMP_PORT_IPV4=1024
ENV GOSNMP_TARGET_IPV6='::1'
ENV GOSNMP_PORT_IPV6=1024
ENV GOSNMP_SNMPD=true
ENTRYPOINT ["/go/src/github.com/gosnmp/gosnmp/build_tests.sh"]