blob: 8ba2353a705de91eb62b792256b6fc4ca78a2bc8 (
plain) (
blame)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# VaporDrop - Multi-stage Docker Build
# Stack: Go + Tor + X25519 + XChaCha20 + BLAKE3
# =============================================================================
# STAGE 1: Build
# =============================================================================
FROM golang:1.21-alpine AS builder
RUN apk add --no-cache git ca-certificates tzdata
WORKDIR /build
# Copy source files
COPY go.mod ./
COPY main.go ./
# Download dependencies and build with security flags
RUN go mod tidy && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build \
-trimpath \
-ldflags="-w -s -buildid=" \
-buildvcs=false \
-o vapordrop \
main.go
# =============================================================================
# STAGE 2: Runtime
# =============================================================================
FROM alpine:3.19
# Install Tor and minimal deps
RUN apk add --no-cache \
tor \
ca-certificates \
tzdata \
&& rm -rf /var/cache/apk/* \
&& mkdir -p /app/static /app/file_storage /app/.tor
# Create non-root user
RUN addgroup -g 1000 vapor && \
adduser -u 1000 -G vapor -h /app -D vapor
WORKDIR /app
# Copy binary from builder
COPY --from=builder /build/vapordrop /app/vapordrop
# Copy static files
COPY static/ /app/static/
# Set ownership
RUN chown -R vapor:vapor /app
# Switch to non-root
USER vapor
EXPOSE 80
ENTRYPOINT ["/app/vapordrop"]
|