-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Dockerfile and instructions to run with docker
- Loading branch information
Showing
3 changed files
with
37 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ venv | |
.coverage | ||
.garmin-cookies.txt | ||
coverage.xml | ||
.env | ||
.env.* |
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,8 @@ | ||
FROM python:3 | ||
ADD ./ /app | ||
WORKDIR /app | ||
RUN pip install -r requirements.txt | ||
VOLUME /data | ||
ENV USERNAME example | ||
ENV PASSWORD examplePassword | ||
ENTRYPOINT ["python", "-m", "garminworkouts", "--cookie-jar", "/data/.garmin-cookies.txt"] |
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 |
---|---|---|
|
@@ -217,3 +217,30 @@ Note: the date format is as follows : 2021-12-31 | |
```shell | ||
python -m garminworkouts -u [GARMIN_USERNAME] -p [GARMIN_PASSWORD] schedule -d [DATE] -w [WORKOUT_ID] | ||
``` | ||
|
||
## Username and password from environment variables | ||
|
||
Alternatively to the `-u` and `-p` arguments, it is possible to load the username and password from the `GARMIN_USERNAME` and `GARMIN_PASSWORD` environment variables: | ||
|
||
```shell | ||
export GARMIN_USERNAME=username | ||
export GARMIN_PASSWORD=password | ||
python -m garminworkouts list | ||
``` | ||
|
||
# Usage with Docker | ||
|
||
```shell | ||
# store your credentials in a .env file | ||
cat <<EOT >> .env | ||
[email protected] | ||
GARMIN_PASSWORD=mypassword | ||
EOT | ||
# name the image | ||
IMAGE=garminworkouts | ||
# build the image | ||
docker build --load -t ${IMAGE} . | ||
# run the image (the "-v /tmp/garmin:/data" part is optional | ||
# and will be used to persist the cookies file) | ||
docker run --env-file=./.env -v /tmp/garmin:/data -ti ${IMAGE} [your command and arguments: list, export, etc.] | ||
``` |