summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGab <24553253+gabrix73@users.noreply.github.com>2026-01-03 03:58:30 +0100
committerGitHub <noreply@github.com>2026-01-03 03:58:30 +0100
commit1c5db776453798d6fb76a693668a9f41cc735095 (patch)
tree9dec32505989603846ab54cf7c3d0d5fdb0bdd01
parent9cc235fb97f32ae41cb468194f1c8a0d828d13aa (diff)
downloadvapordrop-1c5db776453798d6fb76a693668a9f41cc735095.tar.gz
vapordrop-1c5db776453798d6fb76a693668a9f41cc735095.tar.xz
vapordrop-1c5db776453798d6fb76a693668a9f41cc735095.zip
Add multi-stage Dockerfile for VaporDrop build
-rw-r--r--Dockerfile60
1 files changed, 60 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..8ba2353
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,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"]