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
31 changes: 31 additions & 0 deletions Containerfile.gitops
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Build stage
FROM registry.access.redhat.com/ubi9/go-toolset:1.25.5 AS builder

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY . .

USER root
RUN CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o dcm-gitops ./cmd/dcm-gitops

# Runtime stage
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest

WORKDIR /app

COPY --from=builder /app/dcm-gitops .

# Create work directory for git clones
RUN mkdir -p /data/gitops

# OpenShift runs arbitrary UIDs in group 0; g+rwX keeps dirs usable.
RUN chown -R 1001:0 /app /data/gitops && chmod -R g+rwX /app /data/gitops

USER 1001

ENV GIT_WORK_DIR=/data/gitops

ENTRYPOINT ["./dcm-gitops"]
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ include make/placement.mk
include make/policy.mk
include make/sp.mk
include make/agent.mk
include make/gitops.mk

# Same as Containerfile: static build, no CGO (Postgres in prod/compose).
# For SQLite local dev use make run (go run with CGO).
build:
CGO_ENABLED=0 go build -buildvcs=false -o bin/$(BINARY_NAME) ./cmd/$(BINARY_NAME)
CGO_ENABLED=1 go build -buildvcs=false -o bin/$(BINARY_NAME) ./cmd/$(BINARY_NAME)

build-gitops:
CGO_ENABLED=0 go build -buildvcs=false -o bin/dcm-gitops ./cmd/dcm-gitops

# Quick local start with SQLite (no Postgres/NATS stack required).
# Uses a throwaway file under /tmp; override DB_NAME if you want a different path.
Expand Down Expand Up @@ -112,6 +116,6 @@ test:
tidy:
go mod tidy

.PHONY: build run run-dev compose-up compose-up-with-providers compose-down image-build \
clean fmt vet lint test test-catalog test-placement test-policy test-sp tidy \
.PHONY: build build-gitops run run-dev compose-up compose-up-with-providers compose-down image-build \
clean fmt vet lint test test-catalog test-placement test-policy test-sp test-gitops tidy \
helm-chart-sync helm-chart-verify-sync helm-chart-verify-admin-subject helm-chart-verify helm-chart-verify-schema helm-chart-lint helm-chart-template helm-chart-check
Loading