add the ability to specify a CONFIG_FILE env var for the docker image

This commit is contained in:
JesseBot 2024-05-30 10:47:31 +02:00
parent 37317b2a4d
commit e895532dc1
2 changed files with 10 additions and 0 deletions

View file

@ -19,6 +19,8 @@ RUN apk add build-base libffi-dev && \
FROM python:3.12-alpine as deploy FROM python:3.12-alpine as deploy
ENV CONFIG_FILE="/app/tiny_personal_website/config/config.yaml"
WORKDIR /app WORKDIR /app
# copy the already built package # copy the already built package

View file

@ -35,6 +35,14 @@ docker run --rm -p 8000:8080 <name of the tag you used>
Then you can go to http://127.0.0.1:8000 in a browser to view your changes. Then you can go to http://127.0.0.1:8000 in a browser to view your changes.
You can now use an environment variable to set the location of the `config.yaml` to use. Here's an example if you have your config file in your current directory:
```bash
# mount the current directory to /config, and set the CONFIG_FILE env var to /config/config.yaml
# this assumes you've built or pulled jessebot/tiny-personal-website:latest locally
docker run --rm -v .:/config -e CONFIG_FILE=/config/config.yaml -p 8000:8080 jessebot/tiny-personal-website:latest
```
### Deploying on an app platform ### Deploying on an app platform
You want the following command plugged into where-ever this runs You want the following command plugged into where-ever this runs