Last Updated: January 19, 2026
This guide explains how to properly deploy the NIJA trading bot on Railway and Render using Docker.
When deploying to Railway or Render, follow these best practices:
Your repository should contain one Dockerfile that the platform will build automatically.
Current Dockerfile (simplified for platform compatibility):
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["bash", "start.sh"]
docker build commandsRailway Configuration (railway.json):
{
"build": {
"builder": "DOCKERFILE"
}
}
Render Configuration (render.yaml):
services:
- type: web
env: docker
dockerfilePath: ./Dockerfile
docker build in your application codedocker-compose commands/run/docker.sockDocker Compose is designed for local multi-container development, not for cloud platform deployments.
Why it’s removed:
Your application code should never execute Docker commands:
# ❌ BAD - Don't do this
import subprocess
subprocess.run(["docker", "build", "-t", "myapp", "."])
Cloud platforms don’t expose the Docker socket to containers:
# ❌ BAD - Won't work on Railway/Render
import docker
client = docker.from_env() # This will fail
Configuration File: railway.json
builder: DOCKERFILE to use Dockerbash start.sh./DockerfileConfiguration File: render.yaml
env: dockerdockerfilePath: ./DockerfiledockerCommand: bash start.shFor local development, you have two options:
# Install dependencies
pip install -r requirements.txt
# Set environment variables
cp .env.example .env
# Edit .env with your credentials
# Run the bot
./start.sh
# Build the image (BuildKit is enabled by default for better performance)
docker build -t nija-bot .
# Run the container
docker run -d \
--name nija \
--env-file .env \
-p 5000:5000 \
nija-bot
# View logs
docker logs -f nija
# Stop the container
docker stop nija
docker rm nija
Note: For local Docker development, you can build and run directly. However:
All configuration is done via environment variables, not config files in the container.
Setting Environment Variables:
| Platform | Method |
|---|---|
| Railway | Dashboard → Variables → Add Variable |
| Render | Dashboard → Environment → Add Environment Variable |
| Local | Create .env file in repository root |
| Docker CLI | Use --env-file .env or -e KEY=value flags |
Required Variables:
COINBASE_API_KEYCOINBASE_API_SECRETKRAKEN_PLATFORM_API_KEY (if using Kraken)KRAKEN_PLATFORM_API_SECRET (if using Kraken)See .env.example for a complete list.
The Dockerfile has been simplified to follow cloud platform best practices:
Before (Complex):
/usr/src/appAfter (Simple):
pip install -r requirements.txt/appSymptom: Deployment fails during build phase
Solutions:
railway.json has "builder": "DOCKERFILE"render.yaml has env: dockerrequirements.txtSymptom: Build succeeds but container exits immediately
Solutions:
start.sh has executable permissionsSymptom: Import errors or “module not found”
Solutions:
requirements.txtKRAKEN_ENV_VARS_REFERENCE.mdRESTART_DEPLOYMENT.md✅ DO:
.dockerignore to exclude unnecessary files❌ DON’T:
Questions? Check the troubleshooting section or review platform-specific documentation.