-
Notifications
You must be signed in to change notification settings - Fork 0
Add Initial Quickstart/Starter Kit ⚙️ #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lbeckman314
wants to merge
9
commits into
feature/better-middleware
Choose a base branch
from
feature/actions
base: feature/better-middleware
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
566a48c
feat: Add initial Docker workflow for Quick Start
lbeckman314 f3b3649
feat: Add initial Dockerfile
lbeckman314 c587e2b
fix: docker.yaml
lbeckman314 62f77d3
fix: Docker
lbeckman314 7ec4b9e
feat: Update Makefile
lbeckman314 f8209c9
fix: mkdocs dependencies
lbeckman314 20f4028
Update Dockerfile
lbeckman314 4968016
Merge remote-tracking branch 'origin/feature/better-middleware' into …
lbeckman314 e46daf0
feat: Add initial Quick Start section
lbeckman314 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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-24.04 | ||
| - platform: linux/arm64 | ||
| runner: ubuntu-24.04-arm | ||
| runs-on: ${{ matrix.runner }} | ||
| 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 }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Multi-stage build for Go application | ||
| FROM golang:1.24-alpine AS builder | ||
|
|
||
| # Set the working directory | ||
| WORKDIR /app | ||
|
|
||
| # Install git for submodule operations | ||
| RUN apk add --no-cache git | ||
|
|
||
| # Copy go mod files | ||
| COPY go.mod go.sum ./ | ||
|
|
||
| # Download dependencies | ||
| RUN go mod download | ||
|
|
||
| # Copy source code | ||
| COPY . . | ||
|
|
||
| # 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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Dependencies required for build preview on Netlify | ||
| mkdocs | ||
| mkdocs-material | ||
| mkdocs-mermaid2-plugin | ||
| pymdown-extensions | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow doesn't check out the repository before running docker/build-push-action. Since the build context defaults to the workspace ("."), this job will run without a Dockerfile/source tree and the build will fail. Add an actions/checkout step before the Docker meta/build steps (or explicitly set
contextto a remote Git URL).