Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the container game #114

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ s2sphere
svgwrite>=1.1.9
stravalib~=0.10
polyline
timezonefinder
timezonefinder
Loading