-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
38 lines (24 loc) · 895 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
ARG go_version=1.23
# development
FROM golang:${go_version} AS development
ARG kustomize_version=v5.1.1
RUN go install sigs.k8s.io/kustomize/kustomize/v5@${kustomize_version}
COPY . /mischan-bot
WORKDIR /mischan-bot
CMD go mod download \
&& CGO_ENABLED=0 go run main.go
# workspace
FROM golang:${go_version} AS workspace
ARG kustomize_version=v5.1.1
RUN go install sigs.k8s.io/kustomize/kustomize/v5@${kustomize_version}
COPY . /mischan-bot
WORKDIR /mischan-bot
RUN go mod download \
&& CGO_ENABLED=0 go build -buildmode pie -o /mischan-bot/mischan-bot
# production
FROM gcr.io/distroless/base:debug AS production
RUN ["/busybox/sh", "-c", "ln -s /busybox/sh /bin/sh"]
RUN ["/busybox/sh", "-c", "ln -s /bin/env /usr/bin/env"]
COPY --from=workspace /mischan-bot/mischan-bot /bin/mischan-bot
COPY --from=workspace /go/bin/kustomize /bin/kustomize
ENTRYPOINT ["/bin/mischan-bot"]