-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathDockerfile.ruby
More file actions
37 lines (25 loc) · 972 Bytes
/
Dockerfile.ruby
File metadata and controls
37 lines (25 loc) · 972 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/ruby:3.4.1-alpine@sha256:e5c30595c6a322bc3fbaacd5e35d698a6b9e6d1079ab0af09ffe52f5816aec3b
ENV USERNAME=flottbot
ENV GROUP=flottbot
ENV UID=900
ENV GID=900
RUN apk add --no-cache ca-certificates curl jq ruby-dev build-base && mkdir config && \
addgroup -g "$GID" -S "$GROUP" && adduser -S -u "$UID" -G "$GROUP" "$USERNAME"
COPY --from=build /src/flottbot /flottbot
EXPOSE 8080 3000 4000
USER ${USERNAME}
CMD ["/flottbot"]