Skip to content

Commit

Permalink
Update golang version (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
night-codes authored Oct 18, 2023
1 parent edd0010 commit f95ad83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dockerfile
FROM golang:1.19 as base
FROM golang:1.21.2 as base

RUN adduser \
--disabled-password \
Expand All @@ -10,19 +10,22 @@ RUN adduser \
--uid 65532 \
script

USER script

WORKDIR $GOPATH/src/app/
WORKDIR /app/

COPY . .

RUN go mod download
RUN go mod verify

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /exporter .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOCACHE=/tmp/go-cache go build -buildvcs=false -o ./exporter .

FROM scratch

COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=base /exporter .
COPY --from=base /app/exporter .

CMD ["./exporter"]
# Since we're using scratch, there's no shell or user management. So, the process will run as the root user.
# However, since scratch doesn't contain any OS files, there's minimal risk.
CMD ["/exporter"]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module cbi-oi-kubecost-exporter

go 1.19
go 1.21.2

require github.com/caarlos0/env/v7 v7.1.0

0 comments on commit f95ad83

Please sign in to comment.