-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (25 loc) · 949 Bytes
/
Dockerfile
File metadata and controls
37 lines (25 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
FROM --platform=${BUILDPLATFORM} docker.io/golang:1.23.6-alpine@sha256:2c49857f2295e89b23b28386e57e018a86620a8fede5003900f2d138ba9c4037 AS build
ARG TARGETOS
ARG TARGETARCH
ARG VERSION
# needed for vcs feature introduced in go 1.18+
RUN apk add --no-cache git
WORKDIR /src
# Allow for caching
COPY go.mod go.sum ./
RUN go mod download
COPY / .
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -a -ldflags "-s -w -X github.com/target/flottbot/version.Version=${VERSION}" \
-o flottbot ./cmd/flottbot
FROM docker.io/alpine:3.21.2@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099
ENV USERNAME=flottbot
ENV GROUP=flottbot
ENV UID=900
ENV GID=900
RUN apk add --no-cache ca-certificates curl jq && mkdir config && \
addgroup -g "$GID" -S "$GROUP" && adduser -S -u "$UID" -G "$GROUP" "$USERNAME"
COPY --from=build /src/flottbot /flottbot
EXPOSE 3000 4000 8080
USER ${USERNAME}
CMD [ "/flottbot" ]