-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
ARG BASE_IMAGE_TAG=latest | ||
FROM ghcr.io/nationalarchives/tna-python:"$BASE_IMAGE_TAG" | ||
|
||
# ========================================== | ||
# Move the existing build and run scripts to | ||
# a -common suffix so that we can keep using | ||
# the base tna-build and tna-run commands | ||
# ========================================== | ||
RUN set -eux; \ | ||
\ | ||
mv /home/app/.local/bin/tna-run /home/app/.local/bin/tna-run-common | ||
|
||
# ========================================== | ||
# These new commands are just proxies to the | ||
# renamed tna-build/tna-run scripts included | ||
# in the parent Docker image, but with extra | ||
# Django-specific commands | ||
# ========================================== | ||
COPY --chown=app bin/tna-run /home/app/.local/bin/ | ||
|
||
# ========================================== | ||
# Allow all our scripts to be executable | ||
# ========================================== | ||
RUN chmod +x /home/app/.local/bin/tna-run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# tna-python-flask | ||
|
||
This image extends `tna-python` but adds checks for environment variables specific to Flask. | ||
|
||
This image assumes you have a version of Flask added to you project's `pyproject.toml` file. | ||
|
||
## Environment variables | ||
|
||
All environment variables defined in [tna-python](../tna-python/README.md) as well as: | ||
|
||
| Variable | Description | Default | | ||
| ------------ | ----------------------------------------------- | ------- | | ||
| `SECRET_KEY` | A random key used to secure client session data | [None] | | ||
|
||
A secret key can be generated using: | ||
|
||
```sh | ||
python -c 'import secrets; print(secrets.token_hex())' | ||
``` | ||
|
||
## Commands for the Dockerfile | ||
|
||
The command `tna-run` is moved to `tna-run-common` and a new and `tna-run` command is added. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [[ -z $SECRET_KEY ]] | ||
then | ||
echo -e "Error: Environment variable SECRET_KEY not set"; | ||
exit 1 | ||
fi | ||
|
||
tna-run-common "$1" |