Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the docker respository in ko? #87

Open
testwhygh opened this issue Dec 7, 2024 · 1 comment
Open

What's the docker respository in ko? #87

testwhygh opened this issue Dec 7, 2024 · 1 comment

Comments

@testwhygh
Copy link

testwhygh commented Dec 7, 2024

Hello, I am trying to install autoscaler-keda, but I encountered many problems when executing ko apply -f config/.
Error: error creating publisher: KO_DOCKER_REPO environment variable is unset
What is the value of the variable KO_DOCKER_REPO? Thanks

@skonto
Copy link
Contributor

skonto commented Dec 9, 2024

Hi @testwhygh here is the doc for the ko tool: https://ko.build/configuration/ (ko comes from Google).
KO_DOCKER_REPO : "Container repository where to push images built with ko (required)".
For example KO_DOCKER_REPO=docker.io/skonto is my setting pointing to my repo.
ko apply -f config/ builds the images and applies the related yaml files.

Alternatively you could use the recently released file for 1.16 here (it will not be the latest though as this component is actively being developed). If you want to use the latest you will have to build the autoscaler image and replace it in the yaml files (related deployment). Right now there is no dockerfile but we could add one for more flexibility if that helps, here is an example that you could use:

FROM golang AS builder

ARG TARGETOS
ARG TARGETARCH

# Create and change to the app directory.
WORKDIR /app

# Copy local code to the container image.
COPY . ./

RUN go mod tidy

# Build the command inside the container.
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o ./autoscaler-keda ./cmd/autoscaler-keda/

# Use a Docker multi-stage build to create a lean production image.
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
# https://github.com/GoogleContainerTools/distroless#readme
FROM gcr.io/distroless/base:nonroot

# Copy the binaries to the production image from the builder stage.
COPY --from=builder /app/autoscaler-keda /autoscaler-keda

WORKDIR /home/nonroot

# Run the service on container startup.
ENTRYPOINT ["/autoscaler-keda"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants