-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (26 loc) · 1.23 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
FROM golang:latest as builder
LABEL \
org.opencontainers.image.authors="[email protected]" \
org.opencontainers.image.created=$CREATED \
org.opencontainers.image.version=$VERSION \
org.opencontainers.image.revision=$COMMIT \
org.opencontainers.image.url="https://github.com/ntatschner/Tatux.Telemetry" \
org.opencontainers.image.documentation="https://github.com/ntatschner/Tatux.Telemetry" \
org.opencontainers.image.source="https://github.com/ntatschner/Tatux.Telemetry" \
org.opencontainers.image.title="A Telemetry Collection API" \
org.opencontainers.image.description="A Telemetry Collection API that sends data to InfluxDB."
LABEL Author="Nigel Tatschner ([email protected])"
ENV LISTENONPORT=9000 INFLUXDB_URL='http://localhost' INFLUXDB_PORT=8086 INFLUXDB_ORG='DefaultOrg' INFLUXDB_TOKEN='' INFLUXDB_BUCKET='' TRUSTEDPROXIES='' IP2LOCATION_API_KEY=''
RUN mkdir -p builder
WORKDIR /builder
COPY ./src/api/ /builder
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
FROM alpine:latest
RUN apk --no-cache add ca-certificates
ENV APP_HOME=/app
RUN mkdir -p "$APP_HOME"
WORKDIR "$APP_HOME"
COPY --from=builder /builder/main .
EXPOSE $LISTENONPORT
CMD ["./main"]