Skip to content

Commit

Permalink
Adjust dockerfile and prod/images
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalKalke committed Apr 23, 2024
1 parent 7a70def commit f212d61
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 109 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
- name: Create release assets
id: create-assets
env:
IMG: "europe-docker.pkg.dev/kyma-project/prod/serverless-operator:${{ github.event.inputs.name }}"
IMG: "europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator:${{ github.event.inputs.name }}"
PULL_BASE_REF: ${{ github.event.inputs.name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./.github/scripts/release.sh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/operator-verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: upgrade test
run: make -C hack upgrade-test
env:
IMG: europe-docker.pkg.dev/kyma-project/prod/serverless-operator:${{ github.sha }}
IMG: europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator:${{ github.sha }}

gardener-integration-test:
if: github.event_name == 'push'
Expand All @@ -76,7 +76,7 @@ jobs:
- name: run test
run: make -C hack integration-test-on-cluster
env:
IMG: europe-docker.pkg.dev/kyma-project/prod/serverless-operator:${{ github.sha }}
IMG: europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator:${{ github.sha }}
- name: deprovision gardener
# https://docs.github.com/en/actions/learn-github-actions/expressions#always
if: ${{ always() }}
Expand Down
66 changes: 0 additions & 66 deletions .github/workflows/serverless-verify.yaml

This file was deleted.

24 changes: 1 addition & 23 deletions components/operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,13 @@ COPY components/operator components/operator
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o operator ./components/operator/main.go


# Replace main images in values.yaml
# Bumping dockerregistry images in the values.yaml - used for building "local" and "dev" images
FROM alpine:3.19.1 as replacer

WORKDIR /workspace

# TODO: remove variable PURPOSE
ARG PURPOSE
ARG IMG_DIRECTORY
ARG IMG_VERSION

ENV IMG_DIRECTORY=$IMG_DIRECTORY
ENV IMG_VERSION=$IMG_VERSION
ENV PROJECT_ROOT="."

RUN apk update && apk add bash yq

COPY components/operator/hack components/operator/hack
COPY config/docker-registry config/docker-registry
COPY hack/ hack/


# Use distroless as minimal base image to package the operator binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot

WORKDIR /
COPY --chown=65532:65532 --from=builder /workspace/operator .
COPY --chown=65532:65532 --from=replacer /workspace/config/docker-registry /module-chart
COPY --chown=65532:65532 config/docker-registry /module-chart
USER 65532:65532

ENTRYPOINT ["/operator"]
23 changes: 7 additions & 16 deletions components/operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include ${PROJECT_ROOT}/hack/help.mk
# incoming variables

# Image URL to use all building/pushing image targets
IMG ?= europe-docker.pkg.dev/kyma-project/prod/serverless-operator:main
IMG ?= europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator:main

# Setting SHELL to bash allows bash commands to be executed by recipes.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
Expand Down Expand Up @@ -48,13 +48,9 @@ build: generate fmt vet ## Build operator binary.
run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go

.PHONY: docker-build-dev
docker-build-dev: manifests generate ## Build docker dev image with the operator.
docker build -t ${IMG} -f Dockerfile $(PROJECT_ROOT) --build-arg=PURPOSE="dev" --build-arg=IMG_DIRECTORY="$(IMG_DIRECTORY)" --build-arg=IMG_VERSION="$(IMG_VERSION)"

.PHONY: docker-build-local
docker-build-local: manifests generate ## Build docker local image with the operator.
docker build -t ${IMG} -f Dockerfile $(PROJECT_ROOT) --build-arg=PURPOSE="local" --build-arg=IMG_DIRECTORY="$(IMG_DIRECTORY)" --build-arg=IMG_VERSION="$(IMG_VERSION)"
.PHONY: docker-build
docker-build: manifests generate ## Build docker image with the operator.
docker build -t ${IMG} -f Dockerfile $(PROJECT_ROOT)

.PHONY: docker-push
docker-push: ## Push docker image with the operator.
Expand Down Expand Up @@ -98,7 +94,7 @@ generate-kustomization-dev:
.PHONY: deploy
deploy: manifests kustomize generate-kustomization-dev ## Deploy controller to the K8s cluster specified in ~/.kube/config with image from IMG env.
kubectl create namespace kyma-system || true
cd $(CONFIG_OPERATOR_DEV) && $(KUSTOMIZE) edit set image europe-docker.pkg.dev/kyma-project/prod/serverless-operator=${IMG}
cd $(CONFIG_OPERATOR_DEV) && $(KUSTOMIZE) edit set image europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator=${IMG}
$(KUSTOMIZE) build $(CONFIG_OPERATOR_DEV) | kubectl apply -f -


Expand Down Expand Up @@ -141,11 +137,6 @@ print-dockerregistry-details: ## Print all pods, deploys and dockerregistry CRs


##@ Module

.PHONY: module-image-dev
module-image-dev: docker-build-dev docker-push ## Build the dev Module Image and push it to a registry defined in IMG.
echo "built and pushed module image $(IMG)"

.PHONY: module-image-local
module-image-local: docker-build-local docker-push ## Build the local Module Image and push it to a registry defined in IMG.
.PHONY: module-image
module-image: docker-build docker-push ## Build the Module Image and push it to a registry defined in IMG.
echo "built and pushed module image $(IMG)"
2 changes: 1 addition & 1 deletion config/operator/dev/kustomization.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
# To overwrite image in base it has to point to the image in base kustomization.yaml
images:
- name: europe-docker.pkg.dev/kyma-project/prod/serverless-operator
- name: europe-docker.pkg.dev/kyma-project/prod/dockerregistry-operator
newName: local-registry
newTag: local

0 comments on commit f212d61

Please sign in to comment.