Compare commits
No commits in common. "6fdae317f9eda2f73bb56355c433819bb8d12bfc" and "d2c869a0dbd4a71275a6aeb7153acec5015fe913" have entirely different histories.
6fdae317f9
...
d2c869a0db
4 changed files with 13 additions and 36 deletions
27
Dockerfile
27
Dockerfile
|
|
@ -1,27 +0,0 @@
|
||||||
# Use a slim Python image
|
|
||||||
FROM python:3.11-slim
|
|
||||||
|
|
||||||
# Environment: no .pyc files, real-time logs
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1
|
|
||||||
ENV PYTHONUNBUFFERED=1
|
|
||||||
|
|
||||||
# Create working directory
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Install system dependencies
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
||||||
build-essential \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Install Python dependencies
|
|
||||||
COPY requirements.txt .
|
|
||||||
RUN pip install --upgrade pip && pip install -r requirements.txt
|
|
||||||
|
|
||||||
# Copy app code
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Expose Flask port
|
|
||||||
EXPOSE 5000
|
|
||||||
|
|
||||||
# Launch Gunicorn with 4 workers (adjust for your CPU cores)
|
|
||||||
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app", "--workers", "4"]
|
|
||||||
13
app.py
13
app.py
|
|
@ -1,8 +1,21 @@
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from routes import yeastar, voipms
|
from routes import yeastar, voipms
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
# Check for config.py at runtime
|
||||||
|
if not os.path.exists("config.py"):
|
||||||
|
print("config.py not found — creating from config.template.py")
|
||||||
|
try:
|
||||||
|
shutil.copyfile("config.template.py", "config.py")
|
||||||
|
print("Created config.py — please edit it with your real secrets.")
|
||||||
|
sys.exit(1) # Exit so user must edit it manually
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Failed to create config.py: {e}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# Disable Flask/Werkzeug noisy request log
|
# Disable Flask/Werkzeug noisy request log
|
||||||
log = logging.getLogger('werkzeug')
|
log = logging.getLogger('werkzeug')
|
||||||
log.setLevel(logging.ERROR)
|
log.setLevel(logging.ERROR)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
services:
|
|
||||||
webhook-proxy:
|
|
||||||
build: .
|
|
||||||
container_name: webhook-proxy
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- "5000:5000"
|
|
||||||
|
|
@ -19,8 +19,6 @@
|
||||||
<VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">10.0</VisualStudioVersion>
|
<VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">10.0</VisualStudioVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="docker-compose.yml" />
|
|
||||||
<Content Include="Dockerfile" />
|
|
||||||
<Content Include="requirements.txt" />
|
<Content Include="requirements.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue