This commit is contained in:
Jun-te Kim 2025-11-18 22:31:32 +00:00
parent 7ba99bca70
commit 08d5db25d6
5 changed files with 66 additions and 2 deletions

34
Dockerfile.render Normal file
View file

@ -0,0 +1,34 @@
FROM python:3.12-slim
# DO NOT PUSH IMAGE TO ECR!!! as anyone with access to image can log on to our aws
# Will log on as aws Jun-te account, change in the future to development account
ENV AWS_ACCESS_KEY_ID=AKIAU5A36PPNK7RXX52V
ENV AWS_SECRET_ACCESS_KEY=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
ENV AWS_DEFAULT_REGION=eu-west-2
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential curl jq \
&& rm -rf /var/lib/apt/lists/*
# Install Poetry
RUN pip install poetry
# Set working directory
WORKDIR /app
# Copy only Poetry files first (cache layer)
COPY backend/pyproject.toml backend/poetry.lock /app/
# Install dependencies without creating a virtualenv
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi --no-root
# Copy project code
COPY . /app
# Expose port (Render uses PORT env var)
EXPOSE 8000
# Run Dash app via Gunicorn
CMD ["gunicorn", "backend.src.dashboard.main:server", "--bind", "0.0.0.0:8000"]

24
backend/poetry.lock generated
View file

@ -494,6 +494,28 @@ werkzeug = ">=3.1.0"
async = ["asgiref (>=3.2)"]
dotenv = ["python-dotenv"]
[[package]]
name = "gunicorn"
version = "23.0.0"
description = "WSGI HTTP Server for UNIX"
optional = false
python-versions = ">=3.7"
groups = ["main"]
files = [
{file = "gunicorn-23.0.0-py3-none-any.whl", hash = "sha256:ec400d38950de4dfd418cff8328b2c8faed0edb0d517d3394e457c317908ca4d"},
{file = "gunicorn-23.0.0.tar.gz", hash = "sha256:f014447a0101dc57e294f6c18ca6b40227a4c90e9bdb586042628030cba004ec"},
]
[package.dependencies]
packaging = "*"
[package.extras]
eventlet = ["eventlet (>=0.24.1,!=0.36.0)"]
gevent = ["gevent (>=1.4.0)"]
setproctitle = ["setproctitle"]
testing = ["coverage", "eventlet", "gevent", "pytest", "pytest-cov"]
tornado = ["tornado (>=0.2)"]
[[package]]
name = "hubspot-api-client"
version = "12.0.0"
@ -1827,4 +1849,4 @@ type = ["pytest-mypy"]
[metadata]
lock-version = "2.1"
python-versions = ">=3.12"
content-hash = "16f3b01b3600c20d6acd46f8212ec16688c8ad68a5533098789e5f9049011fc6"
content-hash = "e5f24396e682e9ab0a06586c52e2bcc4b9c79c76352b8f752c5f1997808c6b7d"

View file

@ -15,7 +15,8 @@ dependencies = [
"pandas (>=2.3.3,<3.0.0)",
"tqdm (>=4.67.1,<5.0.0)",
"boto3 (>=1.40.74,<2.0.0)",
"dash (>=3.3.0,<4.0.0)"
"dash (>=3.3.0,<4.0.0)",
"gunicorn (>=23.0.0,<24.0.0)"
]
[tool.poetry]

View file

@ -90,6 +90,7 @@ unique_dates = ["All Dates"] + list(unique_dates)
# Dash App
# -------------------------
app = Dash(__name__)
server = app.server # ← REQUIRED for Render/Gunicorn
app.layout = html.Div([
html.H1("Line Items by Expected Commencement Date", style={"textAlign": "center"}),

6
render.yaml Normal file
View file

@ -0,0 +1,6 @@
services:
- type: web
name: dash-dashboard
env: docker
dockerfilePath: ./Dockerfile.render
plan: free