From a8068c85788a661e68f2361cd07fc14dab1a2bb2 Mon Sep 17 00:00:00 2001 From: finn Date: Thu, 1 Aug 2024 22:21:07 -0700 Subject: [PATCH] mgt doc updates --- backend/Dockerfile | 1 + backend/README.md | 28 ++++++++++++++++++++++----- backend/README.md.backup | 42 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 backend/README.md.backup diff --git a/backend/Dockerfile b/backend/Dockerfile index 6e581ef..36d6f5c 100755 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -6,6 +6,7 @@ COPY requirements.txt /code RUN target=/root/.cache/pip \ pip3 install -r requirements.txt +# Need to make this explicit as part of expansion, no migrations or venv COPY . . ENV FLASK_APP app.py diff --git a/backend/README.md b/backend/README.md index fcc71d9..0fc2bd1 100644 --- a/backend/README.md +++ b/backend/README.md @@ -1,7 +1,13 @@ - -pip: +## Workflow: +- should work with flask run locally and dockerfile build +- local dev +- local / venv pip install +- record versionless pips manually here +- pip freeze snapshots into project requirements +- docker build then copies frozen requirements +## pip: ``` pip install flask pip install python-dotenv @@ -10,12 +16,11 @@ pip install flask-sqlalchemy pip install flask-migrate pip install flask-login pip install email-validator - +... pip freeze > requirements.txt ``` -db: - +## db cheat: ``` flask db migrate -m "users table" flask db upgrade @@ -23,4 +28,17 @@ flask db upgrade flask db downgrade [base] flask db upgrade ``` +## build notes: +Dockerfile needs dockerignore or preferably explicitly defined copies for: +- app +- config +- project dir +- requirements +- not dotflaskenv, vars set with dockerfile + +## notes: +- compose has entry that overrides flask with uwsgi for prod +- miminal environment vars come through project env, pass through compose +- no dotenv here, dotflaskenv goes into image +- keep env untracked but templated, dotflaskenv is tracked and public diff --git a/backend/README.md.backup b/backend/README.md.backup new file mode 100644 index 0000000..480b4e2 --- /dev/null +++ b/backend/README.md.backup @@ -0,0 +1,42 @@ +## Workflow: +- should work with flask run and dockerfile build +- local dev +- local pip install +- record versionless pips manually here +- pip freeze snapshots into project requirements +- docker build copies frozen requirements + + +## pip: +``` +pip install flask +pip install python-dotenv +pip install flask-wtf +pip install flask-sqlalchemy +pip install flask-migrate +pip install flask-login +pip install email-validator + +pip freeze > requirements.txt +``` + +## db cheat: +``` +flask db migrate -m "users table" +flask db upgrade + +flask db downgrade [base] +flask db upgrade +``` +## build: + +Dockerfile needs explicitly defined copies for: +- app +- config +- project dir +- requirements + +## notes: +- environment comes through project env passes through compose +- keep env untracked but templated +- no dotenv here, dotflaskenv goes into image