forked from klipitkas/tunnl.gg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (30 loc) · 835 Bytes
/
Dockerfile
File metadata and controls
41 lines (30 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Build stage
FROM golang:1.24-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache git ca-certificates
# Copy go mod files first for better caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build with optimizations
RUN CGO_ENABLED=0 GOOS=linux go build \
-ldflags="-s -w" \
-trimpath \
-o tunnl \
./cmd/tunnl
# Runtime stage - use scratch for smallest possible image
FROM scratch
# Copy CA certificates for HTTPS
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# Copy binary
COPY --from=builder /app/tunnl /tunnl
# Expose ports
# 22: SSH (tunnel connections)
# 80: HTTP (ACME challenges + redirect)
# 443: HTTPS (tunnel traffic)
EXPOSE 22 80 443
# Run as non-root (UID 65534 = nobody)
USER 65534:65534
ENTRYPOINT ["/tunnl"]