-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile
29 lines (26 loc) · 992 Bytes
/
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
############################
# STEP 1 build executable binary
############################
FROM golang:1.16-alpine AS builder
LABEL BUILD="docker build -t insomniacslk/irc-slack -f Dockerfile ."
LABEL RUN="docker run --rm -p 6666:6666 -it insomniacslk/irc-slack"
# Install git.
# Git is required for fetching the dependencies.
RUN apk update && apk add --no-cache git bash make
COPY . $GOPATH/src/github.com/insomniacslk/irc-slack
ENV GO111MODULE=on
WORKDIR $GOPATH/src/github.com/insomniacslk/irc-slack/cmd/irc-slack
# Build the binary.
RUN make
RUN cp irc-slack /go/bin
############################
# STEP 2 build a small image
############################
FROM scratch
# Copy the ssl certs so we can talk to slack
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
# Copy our static executable.
COPY --from=builder /go/bin/irc-slack /go/bin/irc-slack
ENV PATH="/go/bin:$PATH"
# Run the irc-slack binary.
CMD ["/go/bin/irc-slack", "-H", "0.0.0.0"]