forked from kgbvax/wolfmqttbridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (40 loc) · 1.5 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (40 loc) · 1.5 KB
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
############################
# 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 && apk --no-cache add ca-certificates
# Create appuser.
RUN adduser -D -g '' appuser
WORKDIR $GOPATH/src/wolfmqttbridge
COPY go.mod go.sum ./
RUN go mod download
# Assuming the source code is collocated to this Dockerfile
COPY . .
# Fetch dependencies.
# Using go get.
#RUN go get -d -v
# Build the binary.
#RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o /go/bin/wolfmqttbridge
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags='-w -extldflags "-static" -s' -o /wolfmqttbridge
############################
# STEP 2 build a small image
############################
FROM zenika/alpine-chrome:with-node
# Import the user and group files from the builder.
#COPY --from=builder /etc/passwd /etc/passwd
# Copy our static executable.
COPY --chown=chrome --from=builder /wolfmqttbridge /wolfmqttbridge
#COPY certs roots required to validate outbound HTTPS requests
#COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
WORKDIR /
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD 1
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser
COPY --chown=chrome ./authcode-resolver/ /authcode-resolver
COPY --chown=chrome ./container-start.sh /
RUN cd /authcode-resolver && npm install
# Use an unprivileged user.
USER chrome
# Run the binary.
ENTRYPOINT ["/container-start.sh"]