-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (32 loc) · 757 Bytes
/
Dockerfile
File metadata and controls
40 lines (32 loc) · 757 Bytes
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
ARG APP_VERSION=0.0.0-SNAPSHOT
ARG APP_GID=5000
ARG APP_UID=5000
## Build stage
FROM golang:1.16-alpine AS build
ENV CGO_ENABLED=0
WORKDIR /app
# Download deps
COPY go.mod ./
COPY go.sum ./
RUN go mod download
# Build app
ARG APP_VERSION
COPY cmd cmd
COPY util util
RUN go build -v \
-ldflags="-X 'main.appVersion=${APP_VERSION}'" \
-o prometheus-ethermine-exporter \
cmd/prometheus-ethermine-exporter/*.go
# Test
#RUN go test -v .
## Runtime stage
FROM alpine:3 AS runtime
WORKDIR /app
ARG APP_GID
ARG APP_UID
RUN addgroup -g $APP_GID -S app && adduser -G app -u $APP_UID -S app
COPY --from=build /app/prometheus-ethermine-exporter ./
RUN chown app:app prometheus-ethermine-exporter
USER app
ENTRYPOINT ["./prometheus-ethermine-exporter"]
CMD [""]