forked from wimaha/TeslaBleHttpProxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (30 loc) · 976 Bytes
/
Dockerfile
File metadata and controls
30 lines (30 loc) · 976 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
############################
# STEP 1 build executable binary
############################
FROM golang:alpine AS builder
# Install git.
# Git is required for fetching the dependencies.
RUN apk update && apk add --no-cache git tzdata
WORKDIR $GOPATH/src/wimaha/teslaBleHttpProxy/
COPY . .
# Fetch dependencies.
# Using go get.
RUN go get -d -v
# Build the binary.
#RUN go build -o /go/bin/teslaBleHttpProxy
RUN GOOS=linux go build -ldflags="-w -s" -o /go/bin/teslaBleHttpProxy
#RUN sudo setcap 'cap_net_admin=eip' "/go/bin/teslaBleHttpProxy"
RUN mkdir -p /go/bin/key
############################
# STEP 2 build a small image
############################
FROM scratch
# Timezone data
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
ENV TZ=Europe/Berlin
# Copy our static executable.
COPY --from=builder /go/bin/teslaBleHttpProxy /teslaBleHttpProxy
COPY --from=builder /go/bin/key /key
EXPOSE 8080
# Run the teslaBleHttpProxy binary.
ENTRYPOINT ["/teslaBleHttpProxy"]