-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (45 loc) · 1.55 KB
/
Copy pathDockerfile
File metadata and controls
60 lines (45 loc) · 1.55 KB
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
50
51
52
53
54
55
56
57
58
59
60
FROM golang:1.26.4-alpine AS build-env
RUN mkdir /app
WORKDIR /app
ARG version=dev
ARG commit=HEAD
# Copy Go module files first for better layer caching
COPY go.mod go.sum ./
RUN go mod download
# Copy the entire source code
COPY . .
# Build the binary
RUN cd ./cmd/finops-agent && set -e ;\
go build -a -installsuffix cgo \
-ldflags \
"-X github.com/ibm/finops-agent/pkg/version.Version=${version} \
-X github.com/ibm/finops-agent/pkg/version.GitCommit=${commit}" \
-o /go/bin/app
FROM redhat/ubi9-micro:latest
ARG commit
ARG version
ARG occommit
LABEL com.ibm-finops-agent.base.version="${version}"
LABEL com.ibm-finops-agent.base.commit="${commit}"
# REQUIRED FOR RED HAT OPENSHIFT OPERATOR
LABEL name="ibm-finops-agent" \
summary="IBM FinOps Agent" \
description="IBM FinOps Agent" \
vendor="IBM" \
maintainer="kubecost-image-support@wwpdl.vnet.ibm.com" \
version="${version}" \
release="${version}"
ENV CONTAINERIZED="true"
# Add timezone data and set timezone to GMT
ENV TZ=UTC
ADD ./opencost/configs/default.json /models/default.json
ADD ./opencost/configs/azure.json /models/azure.json
ADD ./opencost/configs/aws.json /models/aws.json
ADD ./opencost/configs/gcp.json /models/gcp.json
ADD ./opencost/configs/awsreservationofferings.json /static/awsreservationofferings.json
ADD ./opencost/configs/alibaba.json /models/alibaba.json
COPY --from=build-env /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY LICENSE /licenses/LICENSE
COPY --from=build-env /go/bin/app /go/bin/app
USER 1001
ENTRYPOINT ["/go/bin/app"]