Application templates
Resource | Status |
---|---|
Flask application template | |
Django application template | |
FastAPI application template |
All application templates come with:
- TNA Base Docker images with non-root users
- Docker compose for local development
- Docker build scripts for GitHub Actions ready to run
- Environment configuration
- Poetry for dependency management
- Tests
- Development containers for formatting and testing code
- Formatting configuration
- Healthcheck endpoints
- MKDocs
Flask
GitHub repo: flask-application-template
Features
- Flask
- CSP (Flask Talisman)
- Pytest
- TNA Frontend/TNA Frontend Jinja
- A small API client library
Django
GitHub repo: django-application-template
Features
- Django
- Database for Docker compose
- CSP (Django CSP)
- TNA Frontend/TNA Frontend Jinja
- A small API client library
- WhiteNoise for serving static files in production
FastAPI
GitHub repo: fastapi-application-template
Features
- FastAPI
Using an application template
Setup
- Create a new repository from one of the application templates
- Update the port in the
docker-compose.yml
- Create an action variable in GitHub for
DOCKER_IMAGE_NAME
- this will be the name of the built Docker container
Developing locally
The application templates contain two Docker containers; an app
and a dev
.
The app
container
This is the container for the application.
You can override the base image (IMAGE
) and version (IMAGE_TAG
) in the docker-compose.yml
but by default they use the same non-rooted image as in production. The default values are defined in the Dockerfile
.
The dev
container
See Included scripts in tna-python-dev
.
Possible issues
Using these Docker images in Windows environments could encounter issues with permissions inside the container.
If this occurs, change the IMAGE
build argument in your docker-compose.yml
to the rooted version of the image.
Do not change the image in the Dockerfile
to the rooted version.
Image | Rooted image |
---|---|
tna-python |
tna-python-root |
tna-python-django |
tna-python-django-root |