From 566a48c3675dbaecaefbf9111cc2f367793c973f Mon Sep 17 00:00:00 2001 From: Liam Beckman Date: Mon, 9 Feb 2026 15:47:50 -0800 Subject: [PATCH 1/8] feat: Add initial Docker workflow for Quick Start --- .github/workflows/docker.yaml | 118 ++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 .github/workflows/docker.yaml diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 0000000..aa28d32 --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,118 @@ +# This workflow builds and pushes a multi-arch image to GHCR +# Adapted from actions-arm64-native-example by @gartnera +# ref: https://github.com/gartnera/actions-arm64-native-example/blob/main/.github/workflows/build.yml + +name: build + +on: + push: + +permissions: + contents: read + packages: write + +env: + GHCR_REPO: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }} + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - platform: linux/amd64 + runner: ubuntu-22.04 + - platform: linux/arm64 + runner: ubuntu-22.04-arm + runs-on: ${{ matrix.runner || 'ubuntu-22.04' }} + steps: + - name: Prepare + run: | + platform=${{ matrix.platform }} + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.GHCR_REPO }} + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push by digest + id: build + uses: docker/build-push-action@v6 + with: + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.GHCR_REPO }},push-by-digest=true,name-canonical=true,push=true + + - name: Export digest + run: | + mkdir -p ${{ runner.temp }}/digests + digest="${{ steps.build.outputs.digest }}" + touch "${{ runner.temp }}/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ env.PLATFORM_PAIR }} + path: ${{ runner.temp }}/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: ${{ runner.temp }}/digests + pattern: digests-* + merge-multiple: true + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.GHCR_REPO }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=ref,event=tag + type=sha,prefix= + + - name: Create manifest list and push + working-directory: ${{ runner.temp }}/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.GHCR_REPO }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ env.GHCR_REPO }}:${{ steps.meta.outputs.version }} From f3b3649b06eb3fd657375fd6139faeda4d26dbb6 Mon Sep 17 00:00:00 2001 From: Liam Beckman Date: Mon, 9 Feb 2026 16:00:53 -0800 Subject: [PATCH 2/8] feat: Add initial Dockerfile --- Dockerfile | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a6c04ad --- /dev/null +++ b/Dockerfile @@ -0,0 +1,57 @@ +# Multi-stage build for Go application +FROM golang:1.24-alpine AS builder + +# Set the working directory +WORKDIR /app + +# Install git and make for submodule operations and building +RUN apk add --no-cache git make docker + +# Copy go mod files +COPY go.mod go.sum ./ + +# Download dependencies +RUN go mod download + +# Copy source code +COPY . . + +# Initialize git submodules +RUN git submodule update --init --recursive + +# Build the application +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o drs-server ./cmd/server + +# Final lightweight image +FROM alpine:latest + +# Install ca-certificates for HTTPS requests +RUN apk --no-cache add ca-certificates + +# Create non-root user +RUN addgroup -g 1001 -S appgroup && \ + adduser -u 1001 -S appuser -G appgroup + +WORKDIR /app + +# Copy the binary from builder stage +COPY --from=builder /app/drs-server . + +# Copy the OpenAPI spec file +COPY --from=builder /app/internal/apigen/api/openapi.yaml ./internal/apigen/api/openapi.yaml + +# Change ownership to non-root user +RUN chown -R appuser:appgroup /app + +# Switch to non-root user +USER appuser + +# Expose port 8080 +EXPOSE 8080 + +# Health check +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD wget --no-verbose --tries=1 --spider http://localhost:8080/healthz || exit 1 + +# Run the application +CMD ["./drs-server"] From c587e2b44b0a307273fbdfcee3c33410b092b9c5 Mon Sep 17 00:00:00 2001 From: Liam Beckman Date: Mon, 9 Feb 2026 16:05:57 -0800 Subject: [PATCH 3/8] fix: docker.yaml --- .github/workflows/docker.yaml | 7 +++++++ Dockerfile | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index aa28d32..0c119e3 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -26,6 +26,13 @@ jobs: runner: ubuntu-22.04-arm runs-on: ${{ matrix.runner || 'ubuntu-22.04' }} steps: + # Checkout with submodules enabled + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + - name: Prepare run: | platform=${{ matrix.platform }} diff --git a/Dockerfile b/Dockerfile index a6c04ad..a2d4a6b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ FROM golang:1.24-alpine AS builder WORKDIR /app # Install git and make for submodule operations and building -RUN apk add --no-cache git make docker +RUN apk add --no-cache git # Copy go mod files COPY go.mod go.sum ./ From 62f77d3effcf3365dac2335db7c2a7883fa00c97 Mon Sep 17 00:00:00 2001 From: Liam Beckman Date: Mon, 9 Feb 2026 16:09:24 -0800 Subject: [PATCH 4/8] fix: Docker --- .github/workflows/docker.yaml | 13 +++---------- Dockerfile | 3 --- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 0c119e3..e03b525 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -21,18 +21,11 @@ jobs: matrix: include: - platform: linux/amd64 - runner: ubuntu-22.04 + runner: ubuntu-24.04 - platform: linux/arm64 - runner: ubuntu-22.04-arm - runs-on: ${{ matrix.runner || 'ubuntu-22.04' }} + runner: ubuntu-24.04-arm + runs-on: ${{ matrix.runner }} steps: - # Checkout with submodules enabled - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 0 - - name: Prepare run: | platform=${{ matrix.platform }} diff --git a/Dockerfile b/Dockerfile index a2d4a6b..34d6094 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,9 +16,6 @@ RUN go mod download # Copy source code COPY . . -# Initialize git submodules -RUN git submodule update --init --recursive - # Build the application RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o drs-server ./cmd/server From 7ec4b9ef8a71e70d853407c3c8de8da9c2b4c97f Mon Sep 17 00:00:00 2001 From: Liam Beckman Date: Mon, 9 Feb 2026 16:23:11 -0800 Subject: [PATCH 5/8] feat: Update Makefile --- Makefile | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2cda8e4..412e70b 100644 --- a/Makefile +++ b/Makefile @@ -33,9 +33,19 @@ serve: go run ./cmd/server $(ARGS) .PHONY: docs -docs: - docker run --rm -it \ +docs: docs-serve + +.PHONY: docs-serve +docs-serve: + docker run --rm \ -v "$(PWD):/docs" \ -p 8000:8000 \ $(MKDOCS_IMAGE) \ - serve -a 0.0.0.0:8000 \ No newline at end of file + serve -a 0.0.0.0:8000 + +.PHONY: docs-build +docs-build: + docker run --rm \ + -v "$(PWD):/docs" \ + $(MKDOCS_IMAGE) \ + build From f8209c9ad9c97680c31791e764a5ee663dd136e5 Mon Sep 17 00:00:00 2001 From: Liam Beckman Date: Mon, 9 Feb 2026 16:31:11 -0800 Subject: [PATCH 6/8] fix: mkdocs dependencies --- requirements.txt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8333f11 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +# Dependencies required for build preview on Netlify +mkdocs +mkdocs-material +pymdown-extensions + From 20f402840dc2b7ae512db96aa326200988e993fa Mon Sep 17 00:00:00 2001 From: Liam Beckman Date: Mon, 9 Feb 2026 16:34:06 -0800 Subject: [PATCH 7/8] Update Dockerfile Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 34d6094..55ce3f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM golang:1.24-alpine AS builder # Set the working directory WORKDIR /app -# Install git and make for submodule operations and building +# Install git for submodule operations RUN apk add --no-cache git # Copy go mod files From e46daf0fea30870fa5c5b5e0fb38a601b550071a Mon Sep 17 00:00:00 2001 From: Liam Beckman Date: Mon, 9 Feb 2026 17:02:54 -0800 Subject: [PATCH 8/8] feat: Add initial Quick Start section --- docs/index.md | 27 +++++++++++++++++++++++++++ mkdocs.yml | 3 +++ 2 files changed, 30 insertions(+) diff --git a/docs/index.md b/docs/index.md index c7e884d..a53f8c5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -18,3 +18,30 @@ graph LR B --> C[Data Storage] B --> D[Metadata DB] ``` + +## Quick Start ⚡️ + +!!! warning + Add steps that actually interact with the **DRS Server**: + + - [ ] Listing + - [ ] Registering + - [ ] Retrieving/Resolving DRS URI's → files + +```sh +# TODO: Change to latest tag when stable +# docker run -p 8080:8080 ghcr.io/calypr/drs-server:latest + +➜ docker run -p 8080:8080 ghcr.io/calypr/drs-server:feature-actions +{ + "level": "info", + "caller": "server/main.go:123", + "msg": "listening", + "addr": ":8080" +} + +➜ curl localhost:8080/healthz +{ + "status": "ok" +} +``` diff --git a/mkdocs.yml b/mkdocs.yml index 2e32e78..6d7108b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -27,6 +27,9 @@ markdown_extensions: - admonition - toc: permalink: true + - pymdownx.details + - pymdownx.tasklist: + custom_checkbox: true - pymdownx.superfences: custom_fences: - name: mermaid