Skip to content

Commit

Permalink
Update docker-compose.yaml for easy use.
Browse files Browse the repository at this point in the history
  • Loading branch information
thorian93 committed Jun 2, 2024
1 parent adc1ba5 commit 4b0c975
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 14 deletions.
9 changes: 6 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Refer to the README or `create_poster -h` for details on the below options

TYPE="grid"
TITLE="Running"
YEAR="2017"
ATHLETE="Your name here"
UNITS="imperial"
YEAR="2024"
ATHLETE="John Doe"
UNITS="metric"
EXTRA_OPTIONS=
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ sdist
.mypy_cache

# Project specific
gpx_dir/*
.env
gpx/*
output/*
data
*.svg
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Create a visually appealing poster from your GPX tracks - heavily inspired by https://www.instagram.com/p/Behppx9HCfx/

## Setup
### Local
1. Clone the repository: `git clone https://github.com/flopp/GpxTrackPoster.git`
2. `cd GpxTrackPoster`
3. Create virtualenv: `virtualenv -p /usr/bin/python3 venv` or `python -m venv venv`
Expand All @@ -17,8 +18,19 @@ Create a visually appealing poster from your GPX tracks - heavily inspired by ht

### Container
There is a Dockerfile in this repository, which you can use to run this software.
1. Build the container: `podman build -f Dockerfile -t gpxtrackposter:latest`
2. Run the container to build your poster: `podman run --rm -v /my/gpx/files:/gpx --name gpxtrackposter localhost/gpxtrackposter:latest create_poster --gpx-dir /gpx --output /gpx/poster.svg`

1. Build the container: `podman build -f Dockerfile -t gpxtrackposter:latest`.
2. Run the container to build your poster:
```
podman run --rm -v ./gpx/:/usr/src/app/gpx -v ./output:/usr/src/app/output \
--name gpxtrackposter localhost/gpxtrackposter:latest \
create_poster --gpx-dir /usr/src/app/gpx --output /usr/src/app/output/poster.svg
```

Alternatively you can use the included `docker-compose.yml`, which will do all the above for you.

1. Copy the `.env.example` to `.env` and adapt it to your needs.
2. Run `podman compose up` in the root of this directory.

## Usage
First of all, you need directory with a bunch of GPX files (e.g. you can export all your tracks from Garmin Connect with the excellent tool [garmin-connect-export](https://github.com/kjkjava/garmin-connect-export), or use [StravaExportToGPX](https://github.com/flopp/StravaExportToGPX), or use [runtastic](https://github.com/yihong0618/Runtastic), or use [nrc-exporter](https://github.com/yasoob/nrc-exporter) to convert the activities in a Strava or Runtastic or `Nike Run Club` export zip file to GPX or GPX files).
Expand Down
29 changes: 21 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
app:
build: .
env_file:
- .env
command: /usr/src/app/create_poster.py --type grid --gpx-dir /usr/src/app/gpx_dir --year $YEAR --title $TITLE --athlete $ATHLETE --units $UNITS $EXTRA_OPTIONS --output /usr/src/app/output/output.svg
volumes:
- ./output:/usr/src/app/output
- ./gpx_dir:/usr/src/app/gpx_dir
name: gpxtrackposter

services:
create:
build: ./
image: gpxtrackposter:latest
restart: "no"
env_file:
- .env
command: "/usr/local/bin/create_poster \
--type ${TYPE:-'grid'} \
--title ${TITLE:-'Running'} \
--year ${YEAR:-'2024'} \
--athlete ${ATHLETE:-'John Doe'} \
--units ${UNITS:-'metric'} \
--gpx-dir /usr/src/app/gpx \
${EXTRA_OPTIONS:-'--verbose'} \
--output /usr/src/app/output/output.svg"
volumes:
- ./output:/usr/src/app/output
- ./gpx:/usr/src/app/gpx

0 comments on commit 4b0c975

Please sign in to comment.