feat: prepare all services for production deployment

Co-authored-by: blackboxprogramming <118287761+blackboxprogramming@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-06 02:28:24 +00:00
parent b1953ea883
commit 9085e7a023
37 changed files with 668 additions and 13 deletions

12
roadcoin/.dockerignore Normal file
View File

@@ -0,0 +1,12 @@
__pycache__
*.pyc
*.pyo
.env
.venv
venv
.git
.gitignore
README.md
*.egg-info
dist
.DS_Store

6
roadcoin/.env.example Normal file
View File

@@ -0,0 +1,6 @@
# Server
PORT=8000
APP_ENV=production
# CORS (comma-separated list of allowed origins)
CORS_ORIGINS=https://your-domain.com

10
roadcoin/Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM python:3.11-slim
WORKDIR /app
RUN addgroup --system appgroup && adduser --system --ingroup appgroup appuser
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY --chown=appuser:appgroup . .
USER appuser
EXPOSE 8000
ENV PORT=8000
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]

View File

@@ -11,11 +11,13 @@ app = FastAPI(
version="1.0.0"
)
allowed_origins = os.getenv("CORS_ORIGINS", "http://localhost:3000").split(",")
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_methods=["*"],
allow_headers=["*"],
allow_origins=allowed_origins,
allow_methods=["GET", "POST", "PUT", "DELETE"],
allow_headers=["Content-Type", "Authorization"],
)
class Campaign(BaseModel):
@@ -66,6 +68,15 @@ async def health():
"timestamp": datetime.utcnow().isoformat()
}
@app.get("/api/health")
async def api_health():
return {
"status": "healthy",
"service": "RoadCoin",
"version": "1.0.0",
"timestamp": datetime.utcnow().isoformat()
}
@app.get("/")
async def root():
return {