Skip to content

Docker Setup

Amit Das edited this page Apr 28, 2026 · 1 revision

🐳 Docker Setup

This guide explains how to run SecureAuth using Docker.

Docker deployment provides a clean, isolated, and production-ready environment for SecureAuth.


🚀 Why Use Docker?

Benefits of using Docker:

  • Easy deployment
  • Consistent environments
  • Simplified dependency management
  • Portable deployments
  • Isolation from host system

📋 Requirements

Before starting:

  • Docker installed
  • Docker daemon running

Verify installation:

docker --version

📦 Clone Repository

git clone https://github.com/AmitDas4321/SecureAuth.git

cd SecureAuth

🔐 Configure Environment Variables

Create a .env file.

Example:

# ===============================================
# SecureAuth - ENVIRONMENT CONFIGURATION
# ===============================================

APP_NAME="SecureAuth"
APP_URL="https://example.com"

# TEXTSNAP CONFIG
TEXTSNAP_INSTANCE_ID="YOUR_INSTANCE_ID"
TEXTSNAP_ACCESS_TOKEN="YOUR_ACCESS_TOKEN"

# FIREBASE CONFIG
FIREBASE_DATABASE_URL="YOUR_FIREBASE_DATABASE_URL"
FIREBASE_DATABASE_SECRET="YOUR_FIREBASE_DATABASE_SECRET"

# SECURITY CONFIG
JWT_SECRET="YOUR_SECRET_KEY"
ENCRYPTION_KEY="YOUR_ENCRYPTION_KEY"

🏗 Build Docker Image

Build the SecureAuth Docker image.

docker build -t secureauth .

▶️ Run Docker Container

Run SecureAuth container.

docker run -d \
-p 3000:3000 \
--env-file .env \
--name secureauth-app \
secureauth

🌐 Access Application

Open:

http://localhost:3000

📦 Docker Commands


View Running Containers

docker ps

Stop Container

docker stop secureauth-app

Start Container

docker start secureauth-app

Restart Container

docker restart secureauth-app

Remove Container

docker rm -f secureauth-app

📜 View Logs

View application logs.

docker logs secureauth-app

Live Logs

docker logs -f secureauth-app

🔄 Rebuild Container

After code updates:

docker rm -f secureauth-app
docker build -t secureauth .
docker run -d \
-p 3000:3000 \
--env-file .env \
--name secureauth-app \
secureauth

🌍 Docker with Nginx

Recommended production architecture:

Client
  ↓
Nginx Reverse Proxy
  ↓
Docker Container
  ↓
SecureAuth Application

🔒 HTTPS Recommendation

For production deployments:

  • Use HTTPS
  • Configure SSL certificates
  • Use reverse proxy protection

⚡ Docker Compose (Optional)

Example docker-compose.yml

version: "3.9"

services:

  secureauth:

    build: .

    container_name: secureauth-app

    ports:

      - "3000:3000"

    env_file:

      - .env

    restart: unless-stopped

Start with Docker Compose

docker compose up -d

Stop Compose Services

docker compose down

🔥 Firewall Configuration

Allow required ports.

Example:

sudo ufw allow 3000

Recommended:

sudo ufw allow 80

sudo ufw allow 443

⚠️ Common Docker Issues


Port Already In Use

Error:

Bind for 0.0.0.0:3000 failed

Solution:

lsof -i :3000

Container Crashing

Check logs:

docker logs secureauth-app

Missing Environment Variables

Ensure .env exists.


Build Failure

Clear Docker cache:

docker builder prune

🛡️ Production Recommendations

For production environments:

  • Use reverse proxy
  • Enable HTTPS
  • Restrict server access
  • Monitor container logs
  • Rotate secrets regularly

🔍 Verify Deployment

Test locally:

curl http://127.0.0.1:3000

✅ Next Steps

Continue with:


Secure • Fast • Modern ⚡

Clone this wiki locally