mirror of
https://github.com/blackboxprogramming/blackroad-apps.git
synced 2026-03-17 09:37:52 -05:00
feat: prepare all services for production deployment
Co-authored-by: blackboxprogramming <118287761+blackboxprogramming@users.noreply.github.com>
This commit is contained in:
12
roadcoin/.dockerignore
Normal file
12
roadcoin/.dockerignore
Normal 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
6
roadcoin/.env.example
Normal 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
10
roadcoin/Dockerfile
Normal 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"]
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user