diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index 771e5a49c9..82c8779d55 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -87,6 +87,7 @@ local docker_operator(arch, operator) = { image: 'plugins/docker', settings: { repo: 'grafana/%s' % operator, + context: 'operator', dockerfile: 'operator/Dockerfile', username: { from_secret: docker_username_secret.name }, password: { from_secret: docker_password_secret.name }, diff --git a/.drone/drone.yml b/.drone/drone.yml index 6cf7308e6a..1e0eb0fb1f 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -707,6 +707,7 @@ steps: image: plugins/docker name: build-loki-operator-image settings: + context: operator dockerfile: operator/Dockerfile dry_run: true password: @@ -722,6 +723,7 @@ steps: image: plugins/docker name: publish-loki-operator-image settings: + context: operator dockerfile: operator/Dockerfile dry_run: false password: @@ -759,6 +761,7 @@ steps: image: plugins/docker name: build-loki-operator-image settings: + context: operator dockerfile: operator/Dockerfile dry_run: true password: @@ -774,6 +777,7 @@ steps: image: plugins/docker name: publish-loki-operator-image settings: + context: operator dockerfile: operator/Dockerfile dry_run: false password: @@ -811,6 +815,7 @@ steps: image: plugins/docker name: build-loki-operator-image settings: + context: operator dockerfile: operator/Dockerfile dry_run: true password: @@ -826,6 +831,7 @@ steps: image: plugins/docker name: publish-loki-operator-image settings: + context: operator dockerfile: operator/Dockerfile dry_run: false password: @@ -1411,6 +1417,6 @@ kind: secret name: deploy_config --- kind: signature -hmac: 2082d23dcc8f69038e55b027f55a8b1fe8bc52b27f07d785db781fc935a434ad +hmac: b99e5220d2f2fc15a0bca24bfd3ead78bb6b1ac276fc01ea76a06705fc920190 ... diff --git a/Makefile b/Makefile index 8bf3d386cb..8ee65c85b7 100644 --- a/Makefile +++ b/Makefile @@ -581,9 +581,9 @@ endif # loki-operator loki-operator-image: - $(SUDO) docker build -t $(IMAGE_PREFIX)/loki-operator:$(IMAGE_TAG) -f operator/Dockerfile . + $(SUDO) docker build -t $(IMAGE_PREFIX)/loki-operator:$(IMAGE_TAG) -f operator/Dockerfile operator/ loki-operator-image-cross: - $(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/loki-operator:$(IMAGE_TAG) -f operator/Dockerfile.cross . + $(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/loki-operator:$(IMAGE_TAG) -f operator/Dockerfile.cross operator/ loki-operator-push: loki-operator-image-cross $(SUDO) $(PUSH_OCI) $(IMAGE_PREFIX)/loki-operator:$(IMAGE_TAG) diff --git a/operator/Dockerfile b/operator/Dockerfile index 0c96bed09e..77db603221 100644 --- a/operator/Dockerfile +++ b/operator/Dockerfile @@ -3,17 +3,17 @@ FROM golang:1.17.9 as builder WORKDIR /workspace # Copy the Go Modules manifests -COPY operator/go.mod go.mod -COPY operator/go.sum go.sum +COPY go.mod go.mod +COPY go.sum go.sum # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer RUN go mod download # Copy the go source -COPY operator/main.go main.go -COPY operator/apis/ apis/ -COPY operator/controllers/ controllers/ -COPY operator/internal/ internal/ +COPY main.go main.go +COPY apis/ apis/ +COPY controllers/ controllers/ +COPY internal/ internal/ # Build RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -a -o manager main.go diff --git a/operator/Dockerfile.cross b/operator/Dockerfile.cross index c4252eb862..f19ca81bb4 100644 --- a/operator/Dockerfile.cross +++ b/operator/Dockerfile.cross @@ -8,17 +8,17 @@ FROM --platform=linux/amd64 $BUILD_IMAGE as builder COPY --from=goenv /goarch /goarm / WORKDIR /workspace # Copy the Go Modules manifests -COPY operator/go.mod go.mod -COPY operator/go.sum go.sum +COPY go.mod go.mod +COPY go.sum go.sum # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer RUN go mod download # Copy the go source -COPY operator/main.go main.go -COPY operator/apis/ apis/ -COPY operator/controllers/ controllers/ -COPY operator/internal/ internal/ +COPY main.go main.go +COPY apis/ apis/ +COPY controllers/ controllers/ +COPY internal/ internal/ # Build RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on GOARCH=$(cat /goarch) GOARM=$(cat /goarm) go build -a -o manager main.go