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
48 changes: 48 additions & 0 deletions henrygd/beszel/0.18.8/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
REGISTRY ?=cr.loongnix.cn
ORGANIZATION ?=henrygd
REPOSITORY ?=beszel
TAG ?=0.18.8
LATEST ?=true

IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
IMAGE_AGENT=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY)-agent:$(TAG)
LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest
LATEST_IMAGE_AGENT=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY)-agent:latest
SOURCE_URL=https://github.com/henrygd/beszel.git
SOURCE=$(shell echo $(SOURCE_URL) | awk -F '/' '{print $$NF}' | awk -F '.' '{print $$1}')

default: image

src/$(SOURCE):
git clone -b v$(TAG) --depth 1 $(SOURCE_URL) $@
mkdir -p $@/internal/site/dist
unzip -q beszel-hub-static-assets-v0.18.8.zip -d $@/internal/site/dist

image: src/$(SOURCE)
docker build \
--build-arg http_proxy=$(http_proxy) \
--build-arg https_proxy=$(https_proxy) \
-f dockerfile_hub \
-t $(IMAGE) \
src/$(SOURCE)
docker build \
--build-arg http_proxy=$(http_proxy) \
--build-arg https_proxy=$(https_proxy) \
-f dockerfile_agent \
-t $(IMAGE_AGENT) \
src/$(SOURCE)

push:
docker push $(IMAGE)
docker push $(IMAGE_AGENT)
#latest image
@if [ $(LATEST) = "true" ]; \
then \
docker tag $(IMAGE) $(LATEST_IMAGE); \
docker tag $(IMAGE_AGENT) $(LATEST_IMAGE_AGENT); \
docker push $(LATEST_IMAGE); \
docker push $(LATEST_IMAGE_AGENT); \
fi

clean:
rm -rf src
Binary file not shown.
31 changes: 31 additions & 0 deletions henrygd/beszel/0.18.8/dockerfile_agent
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM cr.loongnix.cn/library/golang:1.27-alpine AS builder

WORKDIR /app

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

# Copy source files
COPY . ./

# Build
RUN CGO_ENABLED=0 GOGC=75 GOOS=linux GOARCH=loong64 go build -ldflags "-w -s" -o /agent ./internal/cmd/agent

RUN rm -rf /tmp/*

# --------------------------
# Final image: default scratch-based agent
# --------------------------
FROM scratch
COPY --from=builder /agent /agent

# this is so we don't need to create the /tmp directory in the scratch container
COPY --from=builder /tmp /tmp

# AMD GPU name lookup (used by agent on Linux when /usr/share/libdrm/amdgpu.ids is read)
COPY --from=builder /app/agent/test-data/amdgpu.ids /usr/share/libdrm/amdgpu.ids

# Ensure data persistence across container recreations
VOLUME ["/var/lib/beszel-agent"]

ENTRYPOINT ["/agent"]
33 changes: 33 additions & 0 deletions henrygd/beszel/0.18.8/dockerfile_hub
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM cr.loongnix.cn/library/golang:1.27-alpine AS builder

WORKDIR /app

# Download Go modules
COPY go.mod go.sum ./
RUN go mod download

# Copy source files
COPY . ./

RUN apk add --no-cache \
unzip \
ca-certificates

RUN update-ca-certificates

# Build
RUN GOEXPERIMENT=nojsonv2 CGO_ENABLED=0 GOGC=75 GOOS=linux GOARCH=loong64 go build -ldflags "-w -s" -o /beszel ./internal/cmd/hub

# ? -------------------------
FROM scratch

COPY --from=builder /beszel /
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

# Ensure data persistence across container recreations
VOLUME ["/beszel_data"]

EXPOSE 8090

ENTRYPOINT [ "/beszel" ]
CMD ["serve", "--http=0.0.0.0:8090"]
Loading