build: update .dockerignore to exclude additional files and directories

- Added exclusions for Git, CI/CD, documentation, IDE, OS, logs, test coverage, and Go-specific files to reduce Docker build context size and improve build performance.

lemon-mint committed Nov 4, 2025 at 12:48 UTC eb17248f307792afaf5bbec67846516680bc4bc4
4 files changed +296
.dockerignore
+33
@@ -1,3 +1,36 @@
1 dist/
2 bin/
3 docker-compose.override.yaml
4 +
5 +# Git
6 +.git
7 +.gitignore
8 +
9 +# CI/CD
10 +.github/
11 +
12 +# Documentation
13 +docs/
14 +*.md
15 +
16 +# IDE
17 +.vscode/
18 +.idea/
19 +*.swp
20 +*.swo
21 +
22 +# OS
23 +.DS_Store
24 +Thumbs.db
25 +
26 +# Logs
27 +*.log
28 +
29 +# Test coverage
30 +coverage.out
31 +coverage.html
32 +
33 +# Go
34 +*.test
35 +*.prof
36 +vendor/
.github/workflows/cd.yml new
+54
@@ -0,0 +1,54 @@
1 +name: CD
2 +
3 +on:
4 + push:
5 + branches: [ main ]
6 + tags: [ 'v*' ]
7 + release:
8 + types: [ published ]
9 +
10 +env:
11 + REGISTRY: ghcr.io
12 + IMAGE_NAME: ${{ github.repository }}
13 +
14 +jobs:
15 + build-and-push:
16 + name: Build and Push Docker Image
17 + runs-on: ubuntu-latest
18 + permissions:
19 + contents: read
20 + packages: write
21 +
22 + steps:
23 + - name: Checkout code
24 + uses: actions/checkout@v4
25 +
26 + - name: Log in to Container Registry
27 + uses: docker/login-action@v3
28 + with:
29 + registry: ${{ env.REGISTRY }}
30 + username: ${{ github.actor }}
31 + password: ${{ secrets.GITHUB_TOKEN }}
32 +
33 + - name: Extract metadata
34 + id: meta
35 + uses: docker/metadata-action@v5
36 + with:
37 + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38 + tags: |
39 + type=ref,event=branch
40 + type=ref,event=pr
41 + type=semver,pattern={{version}}
42 + type=semver,pattern={{major}}.{{minor}}
43 + type=semver,pattern={{major}}
44 + type=sha,prefix={{branch}}-
45 +
46 + - name: Build and push Docker image
47 + uses: docker/build-push-action@v5
48 + with:
49 + context: .
50 + push: true
51 + tags: ${{ steps.meta.outputs.tags }}
52 + labels: ${{ steps.meta.outputs.labels }}
53 + cache-from: type=gha
54 + cache-to: type=gha,mode=max
\ No newline at end of file
.github/workflows/ci.yml new
+121
@@ -0,0 +1,121 @@
1 +name: CI
2 +
3 +on:
4 + pull_request:
5 + branches: [ main, master ]
6 +
7 +jobs:
8 + test:
9 + name: Test
10 + runs-on: ubuntu-latest
11 +
12 + steps:
13 + - name: Checkout code
14 + uses: actions/checkout@v4
15 +
16 + - name: Set up Go
17 + uses: actions/setup-go@v5
18 + with:
19 + go-version: "stable"
20 + check-latest: true
21 +
22 + - name: Cache Go modules
23 + uses: actions/cache@v3
24 + with:
25 + path: |
26 + ~/.cache/go-build
27 + ~/go/pkg/mod
28 + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
29 + restore-keys: |
30 + ${{ runner.os }}-go-
31 +
32 + - name: Download dependencies
33 + run: go mod download
34 +
35 + - name: Install protobuf compiler
36 + run: |
37 + sudo apt-get update
38 + sudo apt-get install -y protobuf-compiler
39 +
40 + - name: Install protoc-gen-go and protoc-gen-go-vtproto
41 + run: |
42 + go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
43 + go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@latest
44 +
45 + - name: Generate protobuf files
46 + run: make build-protoc
47 +
48 + - name: Run tests
49 + run: go test -v -race -coverprofile=coverage.out ./...
50 +
51 + - name: Upload coverage to Codecov
52 + uses: codecov/codecov-action@v3
53 + with:
54 + file: ./coverage.out
55 + flags: unittests
56 + name: codecov-umbrella
57 +
58 + build:
59 + name: Build
60 + runs-on: ubuntu-latest
61 + needs: test
62 +
63 + steps:
64 + - name: Checkout code
65 + uses: actions/checkout@v4
66 +
67 + - name: Set up Go
68 + uses: actions/setup-go@v5
69 + with:
70 + go-version: "stable"
71 + check-latest: true
72 +
73 + - name: Cache Go modules
74 + uses: actions/cache@v3
75 + with:
76 + path: |
77 + ~/.cache/go-build
78 + ~/go/pkg/mod
79 + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
80 + restore-keys: |
81 + ${{ runner.os }}-go-
82 +
83 + - name: Download dependencies
84 + run: go mod download
85 +
86 + - name: Install build dependencies
87 + run: |
88 + sudo apt-get update
89 + sudo apt-get install -y protobuf-compiler binaryen
90 +
91 + - name: Install protoc-gen-go and protoc-gen-go-vtproto
92 + run: |
93 + go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
94 + go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@latest
95 +
96 + - name: Build all components
97 + run: make build
98 +
99 + - name: Build Docker image
100 + run: |
101 + docker build -t relaydns:test .
102 +
103 + lint:
104 + name: Lint
105 + runs-on: ubuntu-latest
106 +
107 + steps:
108 + - name: Checkout code
109 + uses: actions/checkout@v4
110 +
111 + - name: Set up Go
112 + uses: actions/setup-go@v5
113 + with:
114 + go-version: "stable"
115 + check-latest: true
116 +
117 + - name: Run golangci-lint
118 + uses: golangci/golangci-lint-action@v3
119 + with:
120 + version: latest
121 + args: --timeout=5m
\ No newline at end of file
.golangci.yml new
+88
@@ -0,0 +1,88 @@
1 +run:
2 + timeout: 5m
3 + modules-download-mode: readonly
4 +
5 +linters-settings:
6 + govet:
7 + check-shadowing: true
8 + golint:
9 + min-confidence: 0
10 + gocyclo:
11 + min-complexity: 15
12 + maligned:
13 + suggest-new: true
14 + dupl:
15 + threshold: 100
16 + goconst:
17 + min-len: 2
18 + min-occurrences: 2
19 + misspell:
20 + locale: US
21 + lll:
22 + line-length: 140
23 + goimports:
24 + local-prefixes: gosuda.org/portal
25 + gocritic:
26 + enabled-tags:
27 + - diagnostic
28 + - experimental
29 + - opinionated
30 + - performance
31 + - style
32 + disabled-checks:
33 + - dupImport # https://github.com/go-critic/go-critic/issues/845
34 + - ifElseChain
35 + - octalLiteral
36 + - whyNoLint
37 + - wrapperFunc
38 +
39 +linters:
40 + disable-all: true
41 + enable:
42 + - bodyclose
43 + - deadcode
44 + - depguard
45 + - dogsled
46 + - dupl
47 + - errcheck
48 + - funlen
49 + - gochecknoinits
50 + - goconst
51 + - gocritic
52 + - gocyclo
53 + - gofmt
54 + - goimports
55 + - golint
56 + - gomnd
57 + - goprintffuncname
58 + - gosec
59 + - gosimple
60 + - govet
61 + - ineffassign
62 + - interfacer
63 + - lll
64 + - misspell
65 + - nakedret
66 + - rowserrcheck
67 + - scopelint
68 + - staticcheck
69 + - structcheck
70 + - stylecheck
71 + - typecheck
72 + - unconvert
73 + - unparam
74 + - unused
75 + - varcheck
76 + - whitespace
77 +
78 +issues:
79 + exclude-rules:
80 + - path: _test\.go
81 + linters:
82 + - gomnd
83 + - funlen
84 + - goconst
85 + - gocyclo
86 + - path: cmd/
87 + linters:
88 + - gochecknoinits
\ No newline at end of file