Skip to content

Commit 9bdec44

Browse files
committed
Add docker build and publish targets
1 parent 2472ee5 commit 9bdec44

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

justfile

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# storymap justfile
22
# requires: just (https://github.com/casey/just)
33
# pipenv (https://pipenv.pypa.io)
4-
# for release: gh (GitHub CLI)
4+
# for release: gh (GitHub CLI), docker
55

66
pipenv := require("pipenv")
77
gh := require("gh")
8+
docker := require("docker")
89
out_dir := "out"
10+
image := "ghcr.io/mozaicworks/storymap"
911

1012
# List available recipes
1113
default:
@@ -76,7 +78,7 @@ publish-test: build
7678
{{pipenv}} run twine upload --repository testpypi dist/*
7779

7880
# Create a git tag and GitHub release for the current version
79-
release: publish
81+
release: publish docker-push
8082
#!/usr/bin/env bash
8183
set -euo pipefail
8284
version=$({{pipenv}} run python -c "from importlib.metadata import version; print(version('storymap'))")
@@ -88,6 +90,25 @@ release: publish
8890
--title "storymap ${tag}" \
8991
--generate-notes
9092

93+
# Build the Docker image
94+
docker-build:
95+
#!/usr/bin/env bash
96+
set -euo pipefail
97+
version=$({{pipenv}} run python -c "from importlib.metadata import version; print(version('storymap'))")
98+
{{docker}} build -t {{image}}:${version} -t {{image}}:latest .
99+
100+
# Push the Docker image to ghcr.io (run docker-login first if needed)
101+
docker-push: docker-build
102+
#!/usr/bin/env bash
103+
set -euo pipefail
104+
version=$({{pipenv}} run python -c "from importlib.metadata import version; print(version('storymap'))")
105+
{{docker}} push {{image}}:${version}
106+
{{docker}} push {{image}}:latest
107+
108+
# Authenticate with ghcr.io (requires GITHUB_TOKEN env var and GITHUB_USER env var)
109+
docker-login:
110+
echo $GITHUB_TOKEN | {{docker}} login ghcr.io -u $GITHUB_USER --password-stdin
111+
91112
# Show the path to the bundled default template
92113
template-path:
93114
{{pipenv}} run python -c "from pathlib import Path; import storymap; print(Path(storymap.__file__).parent / 'templates' / 'default.html.j2')"

0 commit comments

Comments
 (0)