+40
.dockerignore
+40
.dockerignore
···
1
+
# .dockerignore
2
+
# Git
3
+
.git
4
+
.gitignore
5
+
.github
6
+
7
+
# Documentation
8
+
README.md
9
+
LICENSE
10
+
*.md
11
+
12
+
# Tests
13
+
*_test.go
14
+
coverage.out
15
+
coverage.html
16
+
17
+
# Build artifacts
18
+
plcdns
19
+
*.exe
20
+
*.dll
21
+
*.so
22
+
*.dylib
23
+
*.test
24
+
*.out
25
+
26
+
# IDE
27
+
.vscode
28
+
.idea
29
+
*.swp
30
+
*.swo
31
+
*~
32
+
33
+
# OS
34
+
.DS_Store
35
+
Thumbs.db
36
+
37
+
# Docker
38
+
Dockerfile
39
+
docker-compose.yml
40
+
.dockerignore
+49
Dockerfile
+49
Dockerfile
···
1
+
# Dockerfile
2
+
FROM golang:1.21-alpine AS builder
3
+
4
+
# Install build dependencies
5
+
RUN apk add --no-cache git ca-certificates tzdata
6
+
7
+
# Set working directory
8
+
WORKDIR /app
9
+
10
+
# Copy go mod files
11
+
COPY go.mod go.sum ./
12
+
13
+
# Download dependencies
14
+
RUN go mod download
15
+
16
+
# Copy source code
17
+
COPY . .
18
+
19
+
# Build the application
20
+
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o plcdns .
21
+
22
+
# Final stage
23
+
FROM scratch
24
+
25
+
# Copy CA certificates from builder
26
+
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
27
+
28
+
# Copy timezone data
29
+
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
30
+
31
+
# Copy the binary
32
+
COPY --from=builder /app/plcdns /plcdns
33
+
34
+
# Expose DNS ports (UDP and TCP)
35
+
EXPOSE 53/udp
36
+
EXPOSE 53/tcp
37
+
38
+
# Set default environment variables
39
+
ENV DNS_PORT=53
40
+
41
+
# Run as non-root user (note: for port 53, container must run with --cap-add=NET_BIND_SERVICE)
42
+
USER 65534:65534
43
+
44
+
# Health check
45
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
46
+
CMD ["/plcdns", "-h"] || exit 1
47
+
48
+
# Run the application
49
+
ENTRYPOINT ["/plcdns"]
+2
-2
README.md
+2
-2
README.md
···
18
18
19
19
```bash
20
20
# Clone the repository
21
-
git clone https://github.com/yourusername/plcdns.git
21
+
git clone https://tangled.org/@tree.fail/plcdns
22
22
cd plcdns
23
23
24
24
# Install dependencies
···
44
44
### Using Go Install
45
45
46
46
```bash
47
-
go install github.com/yourusername/plcdns@latest
47
+
go install tangled.org/@tree.fail/plcdns@latest
48
48
```
49
49
50
50
## Usage