Skip to content

Deploy by Docker ​

GCopy provides a single container image with frontend embedded in the Go binary.

Quick Start ​

The browser Clipboard API requires HTTPS. The following example uses a self-signed certificate:

bash
# 1. Generate a self-signed certificate
curl -sSL https://raw.githubusercontent.com/llaoj/gcopy/main/scripts/gen-cert.sh | bash

# 2. Start the container
docker run -d \
  --name gcopy \
  --restart unless-stopped \
  -p 3375:3375 \
  -v $(pwd)/cert.pem:/cert.pem:ro \
  -v $(pwd)/key.pem:/key.pem:ro \
  -e GCOPY_APP_KEY=your-secret-key-min-16-chars \
  -e GCOPY_TLS_CERT_FILE=/cert.pem \
  -e GCOPY_TLS_KEY_FILE=/key.pem \
  llaoj/gcopy:latest

Visit https://<host>:3375. The browser will warn about the self-signed certificate — proceed to continue.

You can also use a valid certificate or a reverse proxy for HTTPS. See TLS Configuration below.

Configuration ​

All configuration is done via environment variables with the GCOPY_ prefix.

Rate limiting: GCopy has no built-in rate limiting. If it is exposed to untrusted clients, apply traffic control at the edge (nginx, Istio, sidecar, ...), especially for POST /api/v1/user/token/generate, POST /api/v1/user/token/verify and POST /api/v1/clipboard.

Token Authentication ​

Users authenticate with an 8-character token.

yaml
# docker run equivalent
-e GCOPY_APP_KEY=your-secret-key-min-16-chars

TLS (Built-in HTTPS) ​

GCopy can load certificates to serve HTTPS directly, no reverse proxy needed:

yaml
-e GCOPY_TLS_CERT_FILE=/path/to/cert.pem
-e GCOPY_TLS_KEY_FILE=/path/to/key.pem
# Mount the certificate files into the container
-v /path/to/cert.pem:/path/to/cert.pem:ro
-v /path/to/key.pem:/path/to/key.pem:ro

Both GCOPY_TLS_CERT_FILE and GCOPY_TLS_KEY_FILE must be set to enable TLS.

Reverse Proxy ​

Run GCopy with HTTP and let a reverse proxy (Nginx, Caddy, etc.) handle TLS:

yaml
-e GCOPY_LISTEN=127.0.0.1:3375
# No TLS environment variables needed

Configure the reverse proxy to forward HTTPS traffic to port 3375.

Environment Variables Reference ​

VariableDescriptionDefaultRequired
GCOPY_APP_KEYEncryption key (min 16 characters)-Yes
GCOPY_LISTENListen address:3375No
GCOPY_TLS_CERT_FILETLS certificate file path-No
GCOPY_TLS_KEY_FILETLS key file path-No
GCOPY_MAX_CONTENT_LENGTHMax clipboard size (MiB)10No
GCOPY_DEBUGDebug modefalseNo

Released under the MIT License.