-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathDockerfile
67 lines (42 loc) · 1.41 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Golang build container
FROM golang:1.17-alpine
RUN apk add --no-cache gcc g++ bash git
WORKDIR $GOPATH/src/github.com/toni-moreno/snmpcollector
COPY go.mod go.sum ./
RUN go mod verify
COPY pkg pkg
COPY .git .git
COPY build.go build.go
RUN go run build.go build
# Node build container
FROM node:8.10.0-alpine
WORKDIR /usr/src/app/
COPY src src
COPY package.json angular-cli.json tslint.json karma.conf.js protractor.conf.js ./
RUN npm install && \
PATH=$(npm bin):$PATH && \
ng build --prod
#RUN find .
# Final container
FROM alpine:3.12
LABEL maintainer="Toni Moreno <[email protected]>"
ARG SNMPCOL_UID="472"
ARG SNMPCOL_GID="472"
ENV PATHS_HOME="/opt/snmpcollector/"
ENV SNMPCOL_GENERAL_DATA_DIR=$PATHS_HOME/data/
ENV SNMPCOL_GENERAL_LOG_DIR=$PATHS_HOME/log/
WORKDIR $PATHS_HOME
RUN apk add --no-cache ca-certificates bash tzdata
COPY conf/sample.config.toml ./conf/config.toml
RUN addgroup -S -g $SNMPCOL_GID snmpcol && \
adduser -S -u $SNMPCOL_UID -G snmpcol snmpcol && \
chown -R snmpcol:snmpcol "$PATHS_HOME" && \
mkdir -p "$SNMPCOL_GENERAL_DATA_DIR" && \
mkdir -p "$SNMPCOL_GENERAL_LOG_DIR" && \
chown -R snmpcol:snmpcol "$SNMPCOL_GENERAL_DATA_DIR" && \
chmod -R 777 "$PATHS_HOME"
COPY --from=0 /go/src/github.com/toni-moreno/snmpcollector/bin/snmpcollector ./bin/
COPY --from=1 /usr/src/app/public ./public
EXPOSE 8090
USER snmpcol
ENTRYPOINT [ "./bin/snmpcollector" ]