-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (31 loc) · 920 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# syntax=docker/dockerfile:1.3-labs
FROM golang:1.19 AS base
RUN apt-get update
RUN apt-get install -y ca-certificates
ENV GO111MODULE=on
ENV GOPROXY=direct
ENV GOSUMDB=off
ENV CGO_ENABLED=0
WORKDIR /root
COPY netrc ./.netrc
RUN chmod 600 /root/.netrc
COPY dockerconfig/gitconfig ./.gitconfig:
RUN mkdir -p ./.ssh/
COPY dockerconfig/ssh_config ./.ssh/config
WORKDIR /app
COPY go.mod ./
COPY go.sum ./
FROM base AS builder
ARG VERSION
ARG GOARCH
ARG GOOS
RUN go mod download
RUN rm -rf /root/.netrc
COPY main.go ./
COPY ./bfc-api ./bfc-api
COPY ./slack-sdk ./slack-sdk
RUN GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags "-X main.VERSION=${VERSION}" -o /bfc-bin-collection-notifier .
FROM debian:stable-slim AS final
COPY --from=builder /bfc-bin-collection-notifier /bfc-bin-collection-notifier
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
CMD ["/bfc-bin-collection-notifier"]