Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,25 @@

FROM docker.io/library/golang:bookworm AS build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to use a different image (following today's discussion)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh. It can wait.


COPY licenses /licenses
COPY hack/tools/queries /opt/crunchy/conf

WORKDIR /usr/src/app
COPY . .

ENV GOCACHE=/var/cache/go
ENV GOMODCACHE=/var/cache/gomod
RUN --mount=type=cache,target=/var/cache \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

second build was much faster with this

<<-SHELL
set -e
go build ./cmd/postgres-operator
go run ./hack/extract-licenses.go licenses postgres-operator

# Build the operator and assemble the licenses
RUN --mount=type=cache,target=/var/cache/go go build ./cmd/postgres-operator
RUN go run ./hack/extract-licenses.go licenses postgres-operator
find ./hack/tools/queries '(' -type d -exec chmod 0555 '{}' + ')' -o '(' -type f -exec chmod 0444 '{}' + ')'
find ./licenses '(' -type d -exec chmod 0555 '{}' + ')' -o '(' -type f -exec chmod 0444 '{}' + ')'
SHELL

FROM docker.io/library/debian:bookworm

COPY --from=build --chmod=0444 /usr/src/app/licenses /licenses
COPY --from=build --chmod=0444 /opt/crunchy/conf /opt/crunchy/conf
COPY --from=build /usr/src/app/licenses /licenses
COPY --from=build /usr/src/app/hack/tools/queries /opt/crunchy/conf
COPY --from=build /usr/src/app/postgres-operator /usr/local/bin

USER 2
Expand Down
Loading