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

add testing docker image for local tests #48

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
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
21 changes: 21 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM golang:1.23-alpine AS build-env

RUN apk add --update --no-cache make bash mailcap

WORKDIR /app
COPY . .

RUN make build

FROM gcr.io/distroless/static-debian12

LABEL maintainer="The Perses Authors <[email protected]>"

USER nobody

COPY --from=build-env --chown=nobody:nobody /app/bin/manager /bin/manager
COPY --chown=nobody:nobody LICENSE /LICENSE
COPY --from=build-env --chown=nobody:nobody /etc/mime.types /etc/mime.types

EXPOSE 8080
ENTRYPOINT [ "/bin/manager" ]
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ run: manifests generate fmt vet ## Run a controller from your host.
image-build: build test ## Build docker image with the manager.
${CONTAINER_RUNTIME} build -f Dockerfile -t ${IMG} .

.PHONY: test-image-build
test-image-build: test ## Build a testing docker image with the manager.
${CONTAINER_RUNTIME} build -f Dockerfile.dev -t ${IMG} .

.PHONY: image-push
image-push: ## Push docker image with the manager.
${CONTAINER_RUNTIME} push ${IMG}
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ An operator to install [Perses](https://github.com/perses/perses) in a k8s clust

## Getting Started

You’ll need a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) to get a local cluster for testing, or run against a remote cluster.
You’ll need:
- a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) to get a local cluster for testing, or run against a remote cluster.
**Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows).
- [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) installed and configured to use your cluster.

### Running on the cluster

Expand All @@ -20,13 +22,13 @@ make install
kubectl apply -k config/samples
```

3. Usint the the location specified by `IMG`, build and push the image to the registry, then deploy the controller to the cluster:
3. Using the the location specified by `IMG`, build a testing image and push it to the registry, then deploy the controller to the cluster:

```sh
IMG=<some-registry>/perses-operator:tag make image-build image-push deploy
IMG=<some-registry>/perses-operator:tag make test-image-build image-push deploy
```

5. Access the Perses UI at `http://localhost:8080` by port-forwarding the service:
4. Port forward the service so you can access the Perses UI at `http://localhost:8080`:

```sh
kubectl port-forward svc/perses-sample 8080:8080
Expand Down
Loading