Skip to content

Commit

Permalink
Add Dockerfile and instructions to run with docker
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fuentes committed Jan 18, 2023
1 parent 5a319c3 commit 5452e9e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ venv
.coverage
.garmin-cookies.txt
coverage.xml
.env
.env.*
8 changes: 8 additions & 0 deletions Dockerfile
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"]
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.]
```

0 comments on commit 5452e9e

Please sign in to comment.