From d0d4e546d990b6a976a4667cc5c90b25ab311d6b Mon Sep 17 00:00:00 2001 From: Henry Dollman Date: Sun, 11 Aug 2024 16:21:02 -0400 Subject: [PATCH] update dockerfiles and docker workflow --- .github/workflows/docker-images.yml | 16 ++++++++-------- beszel/dockerfile_Agent | 8 ++++---- beszel/dockerfile_Hub | 6 ++++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 568e701..aabc263 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -12,12 +12,12 @@ jobs: fail-fast: false matrix: include: - - image: henrygd/beszel - context: ./hub - dockerfile: ./hub/Dockerfile - - image: henrygd/beszel-agent - context: ./agent - dockerfile: ./agent/Dockerfile + - image: henrygd/beszel-test + context: ./beszel + dockerfile: ./dockerfile_Hub + - image: henrygd/beszel-agent-test + context: ./beszel + dockerfile: ./dockerfile_Agent permissions: contents: read packages: write @@ -30,10 +30,10 @@ jobs: uses: oven-sh/setup-bun@v2 - name: Install dependencies - run: bun install --no-save --cwd ./hub/site + run: bun install --no-save --cwd ./beszel/site - name: Build site - run: bun run --cwd ./hub/site build + run: bun run --cwd ./beszel/site build - name: Set up QEMU uses: docker/setup-qemu-action@v3 diff --git a/beszel/dockerfile_Agent b/beszel/dockerfile_Agent index 29873ca..21293f4 100644 --- a/beszel/dockerfile_Agent +++ b/beszel/dockerfile_Agent @@ -2,15 +2,15 @@ FROM --platform=$BUILDPLATFORM golang:alpine AS builder WORKDIR /app -# Download Go modules COPY go.mod go.sum ./ -RUN go mod download - +# RUN go mod download COPY *.go ./ +COPY cmd ./cmd +COPY internal ./internal # Build ARG TARGETOS TARGETARCH -RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-w -s" -o /agent . +RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-w -s" -o /agent ./cmd/agent # ? ------------------------- FROM scratch diff --git a/beszel/dockerfile_Hub b/beszel/dockerfile_Hub index 1f4251d..2e8ff7a 100644 --- a/beszel/dockerfile_Hub +++ b/beszel/dockerfile_Hub @@ -4,10 +4,12 @@ WORKDIR /app # Download Go modules COPY go.mod go.sum ./ -RUN go mod download +# RUN go mod download # Copy source files COPY *.go ./ +COPY cmd ./cmd +COPY internal ./internal COPY migrations ./migrations COPY site/dist ./site/dist COPY site/*.go ./site @@ -20,7 +22,7 @@ RUN update-ca-certificates # Build ARG TARGETOS TARGETARCH -RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-w -s" -o /beszel . +RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-w -s" -o /beszel ./cmd/hub # ? ------------------------- FROM scratch