flask site buildout #2

Merged
finn merged 25 commits from mgtut1 into master 2024-08-05 08:41:03 +00:00
3 changed files with 66 additions and 5 deletions
Showing only changes of commit a8068c8578 - Show all commits

View File

@ -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

View File

@ -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

42
backend/README.md.backup Normal file
View File

@ -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