Skip to content
Merged
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: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.git/
.venv/
__pycache__/
*.egg-info/
dist/
build/
.ruff_cache/
.pytest_cache/
docs/
52 changes: 52 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Docker Publish

on:
push:
tags: ['v*.*.*']

permissions:
contents: read
packages: write

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Derive version + lowercase image name
id: vars
run: |
echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
echo "image=${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"

- uses: docker/setup-qemu-action@v3

- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ steps.vars.outputs.image }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}

- uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
BD_ARCHIVE_VERSION=${{ steps.vars.outputs.version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ venv/

# Local plans (not committed)
docs/plans/

# hatch-vcs generated
src/bd_archive/_version.py
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM python:3.13-slim-bookworm

RUN apt-get update && apt-get install -y --no-install-recommends \
dar \
par2 \
genisoimage \
growisofs \
dvd+rw-tools \
udisks2 \
mount \
eject \
util-linux \
lsof \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

ARG BD_ARCHIVE_VERSION=0.0.0+docker-local
ENV SETUPTOOLS_SCM_PRETEND_VERSION=${BD_ARCHIVE_VERSION}

WORKDIR /src
COPY pyproject.toml README.md ./
COPY src/ ./src/

RUN pip install --no-cache-dir .

WORKDIR /data
ENTRYPOINT ["bd-archive"]
CMD ["--help"]
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
Expand All @@ -16,7 +16,10 @@ bd-archive = "bd_archive.cli:main"
dev = ["ruff>=0.4", "pre-commit>=3.7"]

[tool.hatch.version]
path = "src/bd_archive/__init__.py"
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "src/bd_archive/_version.py"

[tool.hatch.build.targets.wheel]
packages = ["src/bd_archive"]
Expand Down
10 changes: 9 additions & 1 deletion src/bd_archive/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
__version__ = "5.0.0"
try:
from ._version import __version__
except ImportError:
try:
from importlib.metadata import version

__version__ = version("bd-archive")
except Exception:
__version__ = "0.0.0+unknown"
Loading