-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
29 lines (22 loc) · 855 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
# This Dockerfile is only used as an example to build the application locally with Docker.
# Production images are built with https://ko.build/
FROM golang:1.23 AS build
ARG APP_VERSION=unknown
ARG COMMIT_HASH=unknown
WORKDIR /app
# Install dependencies
COPY go.mod go.sum ./
RUN go mod download
# Build application
COPY . ./
RUN CGO_ENABLED=0 go build -trimpath -ldflags " \
-s -w \
-X github.com/Madh93/hoarderbot/internal/version.appVersion=${APP_VERSION} \
-X github.com/Madh93/hoarderbot/internal/version.commitHash=${COMMIT_HASH}" \
-o bin/hoarderbot
FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /app/config.default.toml /var/run/ko/config.default.toml
COPY --from=build /app/bin/hoarderbot .
ENTRYPOINT ["/hoarderbot"]
CMD ["-config", "/var/run/ko/config.default.toml"]