Compare commits

...

6 Commits

Author SHA1 Message Date
Henry Dollman
be4a583126 0.0.1-alpha.3 2024-07-21 20:59:43 -04:00
Henry Dollman
75f1cb619b update hub dockerfile 2024-07-21 20:30:32 -04:00
Henry Dollman
09806e8688 fix update scripts 2024-07-21 20:03:14 -04:00
Henry Dollman
bb295ca297 0.0.1-alpha.2 2024-07-21 19:20:42 -04:00
Henry Dollman
765a4c707b update the update scripts 2024-07-21 19:20:20 -04:00
Henry Dollman
683032f919 add action for docker images 2024-07-21 19:19:58 -04:00
7 changed files with 104 additions and 23 deletions

74
.github/workflows/docker-images.yml vendored Normal file
View File

@@ -0,0 +1,74 @@
name: Make docker images
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: henrygd/beszel
context: ./hub
dockerfile: ./hub/Dockerfile
- image: henrygd/beszel-agent
context: ./agent
dockerfile: ./agent/Dockerfile
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --cwd ./hub/site
- name: Build site
run: bun run --cwd ./hub/site build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value={{sha}},enable=${{ github.ref_type != 'tag' }}
# https://github.com/docker/login-action
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: '${{ matrix.context }}'
file: ${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: ${{ github.ref_type == 'tag' }}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache-from: type=gha
cache-to: type=gha

View File

@@ -23,7 +23,7 @@ import (
psutilNet "github.com/shirou/gopsutil/v4/net"
)
var Version = "0.0.1-alpha.0"
var Version = "0.0.1-alpha.3"
var containerCpuMap = make(map[string][2]uint64)
var containerCpuMutex = &sync.Mutex{}

View File

@@ -2,7 +2,6 @@ package main
import (
"fmt"
"log"
"os"
"strings"
@@ -17,7 +16,10 @@ func updateBeszel() {
currentVersion := semver.MustParse(Version)
fmt.Println("beszel-agent", currentVersion)
fmt.Println("Checking for updates...")
latest, found, err = selfupdate.DetectLatest("henrygd/beszel")
updater, _ := selfupdate.NewUpdater(selfupdate.Config{
Filters: []string{"beszel-agent"},
})
latest, found, err = updater.DetectLatest("henrygd/beszel")
if err != nil {
fmt.Println("Error checking for updates:", err)
@@ -29,7 +31,7 @@ func updateBeszel() {
os.Exit(0)
}
fmt.Println("Latest version", "v", latest.Version)
fmt.Println("Latest version:", latest.Version)
if latest.Version.LTE(currentVersion) {
fmt.Println("You are up to date")
@@ -37,7 +39,7 @@ func updateBeszel() {
}
var binaryPath string
fmt.Printf("Updating from %s to %s...", currentVersion, latest.Version)
fmt.Printf("Updating from %s to %s...\n", currentVersion, latest.Version)
binaryPath, err = os.Executable()
if err != nil {
fmt.Println("Error getting binary path:", err)
@@ -48,5 +50,5 @@ func updateBeszel() {
fmt.Println("Please try rerunning with sudo. Error:", err)
os.Exit(1)
}
log.Printf("Successfully updated: %s -> %s\n\n%s", currentVersion, latest.Version, strings.TrimSpace(latest.ReleaseNotes))
fmt.Printf("Successfully updated to %s\n\n%s\n", latest.Version, strings.TrimSpace(latest.ReleaseNotes))
}

View File

@@ -6,26 +6,29 @@ WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
# Copy source files
COPY *.go ./
COPY migrations ./migrations
COPY site/dist ./site/dist
COPY site/*.go ./site
RUN apk add --no-cache \
unzip \
ca-certificates
RUN update-ca-certificates
# Build
ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-w -s" -o /beszel .
# ? -------------------------
FROM alpine:latest
RUN apk add --no-cache \
unzip \
ca-certificates
FROM scratch
COPY --from=builder /beszel /
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY ./site/dist /site/dist
EXPOSE 8080
EXPOSE 8090
ENTRYPOINT [ "/beszel" ]
CMD ["serve", "--http=0.0.0.0:8080"]
CMD ["serve", "--http=0.0.0.0:8090"]

View File

@@ -31,7 +31,7 @@ import (
"golang.org/x/crypto/ssh"
)
var Version = "0.0.1-alpha.0"
var Version = "0.0.1-alpha.3"
var app *pocketbase.PocketBase
var serverConnections = make(map[string]Server)

View File

@@ -281,7 +281,7 @@ export function UserAuthForm({
<Dialog>
<DialogTrigger asChild>
<button type="button" className={cn(buttonVariants({ variant: 'outline' }))}>
<img className="mr-2 h-4 w-4 dark:invert" src="/icons/github.svg" alt="" />
<img className="mr-2 h-4 w-4 dark:invert" src="/static/github.svg" alt="" />
<span className="translate-y-[1px]">GitHub</span>
</button>
</DialogTrigger>

View File

@@ -2,7 +2,6 @@ package main
import (
"fmt"
"log"
"os"
"strings"
@@ -18,7 +17,10 @@ func updateBeszel(cmd *cobra.Command, args []string) {
currentVersion := semver.MustParse(Version)
fmt.Println("beszel", currentVersion)
fmt.Println("Checking for updates...")
latest, found, err = selfupdate.DetectLatest("henrygd/beszel")
updater, _ := selfupdate.NewUpdater(selfupdate.Config{
Filters: []string{"beszel_"},
})
latest, found, err = updater.DetectLatest("henrygd/beszel")
if err != nil {
fmt.Println("Error checking for updates:", err)
@@ -30,7 +32,7 @@ func updateBeszel(cmd *cobra.Command, args []string) {
os.Exit(0)
}
fmt.Println("Latest version", "v", latest.Version)
fmt.Println("Latest version:", latest.Version)
if latest.Version.LTE(currentVersion) {
fmt.Println("You are up to date")
@@ -38,7 +40,7 @@ func updateBeszel(cmd *cobra.Command, args []string) {
}
var binaryPath string
fmt.Printf("Updating from %s to %s...", currentVersion, latest.Version)
fmt.Printf("Updating from %s to %s...\n", currentVersion, latest.Version)
binaryPath, err = os.Executable()
if err != nil {
fmt.Println("Error getting binary path:", err)
@@ -49,5 +51,5 @@ func updateBeszel(cmd *cobra.Command, args []string) {
fmt.Println("Please try rerunning with sudo. Error:", err)
os.Exit(1)
}
log.Printf("Successfully updated: %s -> %s\n\n%s", currentVersion, latest.Version, strings.TrimSpace(latest.ReleaseNotes))
fmt.Printf("Successfully updated to %s\n\n%s\n", latest.Version, strings.TrimSpace(latest.ReleaseNotes))
}