Compare commits

...

8 Commits

9 changed files with 849 additions and 267 deletions
+73 -11
View File
@@ -11,11 +11,20 @@ jobs:
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@@ -32,21 +41,74 @@ jobs:
with:
images: ${{ secrets.DOCKER_REGISTRY }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=semver,pattern={{raw}}
type=raw,value=latest
- name: Build and push Docker image
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
cache-from: type=gha,scope=build-${{ matrix.platform }}
cache-to: type=gha,mode=max,scope=build-${{ matrix.platform }}
outputs: type=image,name=${{ secrets.DOCKER_REGISTRY }},push-by-digest=true,name-canonical=true,push=true
- name: Image digest
run: echo ${{ steps.meta.outputs.digest }}
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ strategy.job-index }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
packages: write
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_REGISTRY }}
tags: |
type=semver,pattern={{raw}}
type=raw,value=latest
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ secrets.DOCKER_REGISTRY }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ secrets.DOCKER_REGISTRY }}:${{ steps.meta.outputs.version }}
+12 -5
View File
@@ -4,7 +4,8 @@ WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm install
RUN --mount=type=cache,target=/root/.npm \
npm install
COPY frontend/ .
@@ -14,17 +15,23 @@ FROM golang:1.25.4-alpine3.22 AS backend-builder
WORKDIR /app
RUN go install github.com/swaggo/swag/cmd/swag@latest
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go install github.com/swaggo/swag/cmd/swag@latest
COPY backend/go.mod backend/go.sum ./
RUN go mod download
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY backend .
RUN swag init
RUN --mount=type=cache,target=/root/.cache/go-build \
swag init
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o garage-ui .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o garage-ui .
FROM alpine:3.22
+13
View File
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
"strings"
"time"
"Noooste/garage-ui/internal/config"
@@ -24,9 +25,20 @@ type S3Service struct {
// NewS3Service creates a new S3 service instance using MinIO SDK
func NewS3Service(cfg *config.GarageConfig, adminService *GarageAdminService) *S3Service {
// Create MinIO client for Garage
// trim http or https from endpoint
if strings.HasPrefix(cfg.Endpoint, "http://") {
cfg.Endpoint = strings.TrimPrefix(cfg.Endpoint, "http://")
}
if strings.HasPrefix(cfg.Endpoint, "https://") {
cfg.Endpoint = strings.TrimPrefix(cfg.Endpoint, "https://")
cfg.UseSSL = true
}
client, err := minio.New(cfg.Endpoint, &minio.Options{
//Creds: credentials.NewStaticV4(cfg.AccessKey, cfg.SecretKey, ""),
Secure: cfg.UseSSL,
Region: cfg.Region,
})
if err != nil {
panic(fmt.Errorf("failed to create MinIO client: %w", err))
@@ -99,6 +111,7 @@ func (s *S3Service) getMinioClient(ctx context.Context, bucketName string) (*min
client, err := minio.New(s.config.Endpoint, &minio.Options{
Creds: creds,
Secure: s.config.UseSSL,
Region: s.config.Region,
})
if err != nil {
return nil, fmt.Errorf("failed to create MinIO client for bucket %s: %w", bucketName, err)
+2 -2
View File
@@ -2,8 +2,8 @@ apiVersion: v2
name: garage-ui
description: A Helm chart for Garage UI - Web interface for Garage S3 object storage
type: application
version: 0.1.0
appVersion: "v0.0.4"
version: 0.1.2
appVersion: "v0.0.6"
keywords:
- garage
- s3
+710 -248
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -6,4 +6,6 @@ metadata:
{{- include "garage-ui.labels" . | nindent 4 }}
data:
config.yaml: |
{{- .Values.config | toYaml | nindent 4 }}
{{- $config := deepCopy .Values.config }}
{{- $_ := unset $config.garage "admin_token" }}
{{- $config | toYaml | nindent 4 }}
+11
View File
@@ -35,6 +35,17 @@ spec:
- name: http
containerPort: 8080
protocol: TCP
env:
- name: GARAGE_UI_GARAGE_ADMIN_TOKEN
valueFrom:
secretKeyRef:
{{- if .Values.config.garage.existingSecret.name }}
name: {{ .Values.config.garage.existingSecret.name }}
key: {{ .Values.config.garage.existingSecret.key }}
{{- else }}
name: {{ include "garage-ui.fullname" . }}-admin-token
key: admin-token
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
+11
View File
@@ -0,0 +1,11 @@
{{- if and (not .Values.config.garage.existingSecret.name) .Values.config.garage.admin_token }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "garage-ui.fullname" . }}-admin-token
labels:
{{- include "garage-ui.labels" . | nindent 4 }}
type: Opaque
data:
admin-token: {{ .Values.config.garage.admin_token | b64enc | quote }}
{{- end }}
+14
View File
@@ -87,8 +87,22 @@ config:
# REQUIRED: Obtain this from your Garage server configuration
# This token grants administrative access - keep it secure!
# To generate: See Garage documentation for admin token setup
# NOTE: If existingSecret is configured, this value will be ignored
admin_token: ""
# Use an existing Kubernetes secret for the admin token (recommended for production)
# When configured, this takes precedence over the admin_token value above
# The secret should contain a key with the admin token value
existingSecret:
# Name of the existing secret containing the admin token
# Leave empty to use the admin_token value above instead
# Example: "garage-admin-token"
name: ""
# Key within the secret that contains the admin token value
# Default: "admin-token"
key: "admin-token"
# ========================================
# Authentication Configuration
# ========================================