-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (26 loc) · 949 Bytes
/
Dockerfile
File metadata and controls
38 lines (26 loc) · 949 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
# To use git command for golang-mysql-driver
# FROM ubuntu:latest
# RUN apt-get -y update
# RUN apt-get -y install git
### Builder
FROM golang:latest as builder
# RUN apk update && apk add git && apk add ca-certificates
WORKDIR $GOPATH/src/chatbot
# golang-mysql-driver requires git command
RUN set -ex && apk add --no-cache --virtual git
ADD . .
# Install all dependencies
RUN go get -d -v ./...
# where modules save /go/pkg/mod/github.com/
COPY soup.go /go/pkg/mod/github.com/anaskhan96/soup@v1.2.5
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-w -s' -o /bin/chatbot main/main.go
RUN chmod +x /bin/chatbot
ENV GO_MYSQL "ID:PASSWD@tcp(RDS_SERVER)/notices"
ENV GO111MODULE "auto"
EXPOSE 8008
### Make executable image
FROM scratch
# COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /bin/chatbot /bin/chatbot
CMD [ "/bin/chatbot" ]