Add Dockerfile

This commit is contained in:
Stéphane Bidoul 2021-11-05 09:44:34 +01:00
parent e100c838a5
commit de2a95dc7d
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92
6 changed files with 42 additions and 8 deletions

View file

@ -1,6 +1,6 @@
RUNBOAT_SUPPORTED_REPOS=["OCA/mis-builder", "shopinvader/odoo-shopinvader", "OCA/server-env"] RUNBOAT_SUPPORTED_REPOS=["OCA/mis-builder", "shopinvader/odoo-shopinvader", "OCA/server-env"]
RUNBOAT_ADMIN_USER="admin" RUNBOAT_API_ADMIN_USER="admin"
RUNBOAT_ADMIN_PASSWD="admin" RUNBOAT_API_ADMIN_PASSWD="admin"
RUNBOAT_BUILD_NAMESPACE=runboat-builds RUNBOAT_BUILD_NAMESPACE=runboat-builds
RUNBOAT_BUILD_PGHOST=postgres14.runboat-builds-db RUNBOAT_BUILD_PGHOST=postgres14.runboat-builds-db
RUNBOAT_BUILD_PGPORT=5432 RUNBOAT_BUILD_PGPORT=5432
@ -8,3 +8,5 @@ RUNBOAT_BUILD_PGUSER=runboat-build
RUNBOAT_BUILD_PGPASSWORD=... RUNBOAT_BUILD_PGPASSWORD=...
RUNBOAT_BUILD_ADMIN_PASSWD=... RUNBOAT_BUILD_ADMIN_PASSWD=...
RUNBOAT_BUILD_DOMAIN=runboat.odoo-community.org RUNBOAT_BUILD_DOMAIN=runboat.odoo-community.org
RUNBOAT_GITHUB_TOKEN=
RUNBOAT_LOG_CONFIG=log-config.yaml

32
Dockerfile Normal file
View file

@ -0,0 +1,32 @@
FROM python:3.10
LABEL maintainer="Stéphane Bidoul"
RUN pip install --no-cache-dir --upgrade "pip>=21.3.1"
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
COPY src /app
ENV PYTHONPATH=/app
COPY log-config.yaml /etc/runboat-log-config.yaml
ENV RUNBOAT_SUPPORTED_REPOS='["oca/server-env", "oca/mis-builder"]'
ENV RUNBOAT_API_ADMIN_USER="admin"
ENV RUNBOAT_API_ADMIN_PASSWD=
ENV RUNBOAT_BUILD_NAMESPACE=runboat-builds
ENV RUNBOAT_BUILD_PGHOST=postgres14.runboat-builds-db
ENV RUNBOAT_BUILD_PGPORT=5432
ENV RUNBOAT_BUILD_PGUSER=runboat-build
ENV RUNBOAT_BUILD_PGPASSWORD=
ENV RUNBOAT_BUILD_ADMIN_PASSWD=
ENV RUNBOAT_BUILD_DOMAIN=runboat.example.com
ENV RUNBOAT_GITHUB_TOKEN=
ENV RUNBOAT_LOG_CONFIG=/etc/runboat-log-config.yaml
ENV KUBECONFIG=/run/kubeconfig
EXPOSE 8000
CMD [ "gunicorn", "-w", "1", "-k", "runboat.uvicorn.RunboatUvicornWorker", "runboat.app:app"]

View file

@ -68,7 +68,7 @@ in a different cluster.
- setup environment variables (start from `.env.sample`) - setup environment variables (start from `.env.sample`)
- create a virtualenv, make sure to have pip>=21.3.1 and `pip install -e .` - create a virtualenv, make sure to have pip>=21.3.1 and `pip install -e .`
- run with `uvicorn runboat.app:app --log-config=log-config-dev.yaml` - run with `uvicorn runboat.app:app --log-config=log-config.yaml`
## Running in production ## Running in production
@ -128,7 +128,7 @@ MVP:
- k8s init container timeout - k8s init container timeout
- better error handling in API (return 400 on user errors) - better error handling in API (return 400 on user errors)
- basic tests - basic tests
- build and publish runboat container image - publish runboat container image
- look at other TODO in code to see if anything important remains - look at other TODO in code to see if anything important remains
- basic UI (single page with a combo box to select repo and show builds by branch/pr, - basic UI (single page with a combo box to select repo and show builds by branch/pr,
with start/stop buttons) with start/stop buttons)

View file

@ -11,11 +11,11 @@ security = HTTPBasic()
def authenticated(credentials: HTTPBasicCredentials = Depends(security)) -> None: def authenticated(credentials: HTTPBasicCredentials = Depends(security)) -> None:
correct_username = secrets.compare_digest( correct_username = secrets.compare_digest(
credentials.username, credentials.username,
settings.admin_user, settings.api_admin_user,
) )
correct_password = secrets.compare_digest( correct_password = secrets.compare_digest(
credentials.password, credentials.password,
settings.admin_passwd, settings.api_admin_passwd,
) )
if not (correct_username and correct_password): if not (correct_username and correct_password):
raise HTTPException( raise HTTPException(

View file

@ -4,8 +4,8 @@ from pydantic import BaseSettings
class Settings(BaseSettings): class Settings(BaseSettings):
admin_user: str api_admin_user: str
admin_passwd: str api_admin_passwd: str
supported_repos: set[str] supported_repos: set[str]
max_initializing: int = 2 max_initializing: int = 2
max_started: int = 6 max_started: int = 6