Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Binary
/microshift-installer
/microshift-installer.exe
/manager

# Asset / state directories
my-cluster/
Expand Down
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Build the manager binary
FROM golang:1.26 AS builder

WORKDIR /workspace

# Copy go.mod and go.sum first for better layer caching
COPY go.mod go.sum ./
RUN go mod download

# Copy the rest of the source code
COPY . .

# Build the manager binary
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager ./cmd/manager/

# Runtime image
FROM gcr.io/distroless/static:nonroot AS runtime
WORKDIR /

COPY --from=builder /workspace/manager .

USER 65532:65532

ENTRYPOINT ["/manager"]
74 changes: 74 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Build the manager binary
IMAGE_TAG ?= latest
IMG ?= microshift-installer:$(IMAGE_TAG)

.PHONY: help
help:
@echo "Usage:"
@echo " make cli Build the CLI binary (microshift-installer)"
@echo " make build Build the operator manager binary"
@echo " make run Run the operator locally"
@echo " make docker-build Build the operator Docker image"
@echo " make deploy Deploy the operator to a K8s cluster"
@echo " make install Install CRDs into the cluster"
@echo " make uninstall Uninstall CRDs from the cluster"
@echo " make vet Run go vet"
@echo " make fmt Run go fmt"

.PHONY: cli
cli:
go build -o bin/microshift-installer ./cmd/microshift-installer/

.PHONY: build
build:
go build -o bin/manager ./cmd/manager/

.PHONY: run
run:
go run ./cmd/manager/

.PHONY: docker-build
docker-build:
docker build -t $(IMG) .

.PHONY: docker-push
docker-push:
docker push $(IMG)

.PHONY: install
install:
kubectl apply -f config/crd/

.PHONY: uninstall
uninstall:
kubectl delete -f config/crd/

.PHONY: deploy
deploy: install
kubectl apply -f config/rbac/
kubectl apply -f config/manager/

.PHONY: undeploy
undeploy:
kubectl delete -f config/manager/
kubectl delete -f config/rbac/
-kubectl delete -f config/crd/

.PHONY: vet
vet:
go vet ./...

.PHONY: fmt
fmt:
gofmt -l . > fmt_output
@if [ -s fmt_output ]; then \
echo "Unformatted files:"; \
cat fmt_output; \
rm fmt_output; \
exit 1; \
fi
@rm -f fmt_output

.PHONY: clean
clean:
rm -rf bin/
Loading
Loading