-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (33 loc) · 1.07 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
43
44
45
46
47
48
49
50
51
# Build image
FROM golang:1.14-alpine3.11 AS builder
#ENV GOFLAGS="-mod=readonly"
RUN apk add --update --no-cache ca-certificates make git curl mercurial bzr
RUN mkdir -p /workspace
WORKDIR /workspace
ARG GOPROXY
COPY go.* ./
RUN go mod download
ARG BUILD_TARGET
COPY Makefile *.mk ./
RUN if [[ "${BUILD_TARGET}" == "debug" ]]; then make build-debug-deps; else make build-release-deps; fi
COPY . .
COPY config.toml /build/
RUN set -xe && \
if [[ "${BUILD_TARGET}" == "debug" ]]; then \
cd /tmp; GOBIN=/workspace/build/debug go get github.com/go-delve/delve/cmd/dlv; cd -; \
make build-debug; \
mv build/debug /build; \
else \
make build-release; \
mv build/release /build; \
fi
# Final image
FROM alpine:3.11
RUN apk add --update --no-cache ca-certificates tzdata bash curl
SHELL ["/bin/bash", "-c"]
ARG BUILD_TARGET
RUN if [[ "${BUILD_TARGET}" == "debug" ]]; then apk add --update --no-cache libc6-compat; fi
COPY --from=builder /build/* /usr/local/bin/
COPY --from=builder /build/config.toml ./
EXPOSE 8080
CMD ["binomo-bot"]