Previously, the Dockerfile tried to copy the instance/ directory which is gitignored and doesn't exist in fresh clones. This caused deployment to fail with "instance/: not found" error. Changes: - Add docker-entrypoint.sh script to auto-generate JWT keys if missing - Install openssl in container for key generation - Remove COPY instance/ from Dockerfile (no longer needed) - Create instance/ directory during build - Set ENTRYPOINT to run initialization script before starting Gunicorn This allows the application to deploy successfully on fresh clones without requiring manual JWT key generation. Fixes deployment issue on production servers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
1.1 KiB
Bash
Executable File
40 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Docker entrypoint script for OIDC Identity Provider
|
|
# Generates JWT keys if they don't exist and starts the application
|
|
|
|
set -e
|
|
|
|
echo "========================================"
|
|
echo "OIDC IdP - Container Initialization"
|
|
echo "========================================"
|
|
|
|
# Create instance directory if it doesn't exist
|
|
mkdir -p /app/instance
|
|
|
|
# Generate JWT keys if they don't exist
|
|
if [ ! -f /app/instance/jwt_private.pem ]; then
|
|
echo "Generating JWT RSA key pair..."
|
|
|
|
# Generate private key (2048-bit RSA)
|
|
openssl genrsa -out /app/instance/jwt_private.pem 2048
|
|
|
|
# Extract public key from private key
|
|
openssl rsa -in /app/instance/jwt_private.pem -pubout -out /app/instance/jwt_public.pem
|
|
|
|
# Set proper permissions
|
|
chmod 600 /app/instance/jwt_private.pem
|
|
chmod 644 /app/instance/jwt_public.pem
|
|
|
|
echo "✓ JWT keys generated successfully"
|
|
else
|
|
echo "✓ JWT keys already exist"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Starting OIDC server..."
|
|
echo "========================================"
|
|
echo ""
|
|
|
|
# Execute the CMD from Dockerfile (Gunicorn)
|
|
exec "$@"
|