Missing arm64 docker image
$ docker run --rm --name subliminal -v subliminal_cache:/usr/src/cache -v `pwd`:/app -w /app -it diaoulael/subliminal download -l en blah.avi
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
exec /usr/local/bin/subliminal: exec format error
i suppose we could build those? i'm using subliminal on arm64 and it works just fine, though i'm not sure how to wire GH Actions to building cross-platform yet
it should be pretty straight forward to add docker image publishing from github workflow.
The existing Dockerfile doesn't seem to be specific to x64:
- https://github.com/Diaoul/subliminal/blob/da2817da2cee503cdc7f4bcc9595d7ecefae4a23/Dockerfile
I can send a PR if there's no obvious reason pointed out why that would be rejected.
Current, local workaround, build the image locally:
docker build -t diaoulael/subliminal "https://github.com/Diaoul/subliminal.git#HEAD"
or build from git checkout:
git clone https://github.com/Diaoul/subliminal --depth 1
docker build -t diaoulael/subliminal subliminal/
Something not right yet
diff --git a/.dockerignore b/.dockerignore
index b77cc43..2547808 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,5 +1,4 @@
# SCM
-.git/
# Byte-compiled / optimized / DLL files
__pycache__/
diff --git a/Dockerfile b/Dockerfile
index 60f3903..9ff7064 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -30,6 +30,7 @@ VOLUME /usr/src/cache
COPY . /usr/src/app
RUN python -m pip install -U pip
+RUN apk add git
RUN python -m pip install .
had to make those local changes for build to succeed.
@ptrcnull It's pretty straight forward, and imho well documented
- https://docs.docker.com/build/ci/github-actions/
I've using those actions in few projects
- https://github.com/Taxel/PlexTraktSync/blob/458498a921ae25e0eb1193403a1637d2ac2555c2/.github/workflows/docker-image.yml
@glensc Can you write a PR for it? @DerouineauNicolas can help maybe.
How is the current docker image built that it doesn't require git:
- https://github.com/Diaoul/subliminal/issues/1196#issuecomment-2532163465
Please share exact details to be able to reproduce this locally.
The error I'm getting is:
> [8/8] RUN python -m pip install .:
0.357 Processing /usr/src/app
0.359 Installing build dependencies: started
3.516 Installing build dependencies: finished with status 'done'
3.517 Getting requirements to build wheel: started
3.587 Getting requirements to build wheel: finished with status 'done'
3.588 Preparing metadata (pyproject.toml): started
3.722 Preparing metadata (pyproject.toml): finished with status 'error'
3.726 error: subprocess-exited-with-error
3.726
3.726 × Preparing metadata (pyproject.toml) did not run successfully.
3.726 │ exit code: 1
3.726 ╰─> [32 lines of output]
3.726 Traceback (most recent call last):
3.726 File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
3.726 main()
3.726 File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
3.726 json_out["return_val"] = hook(**hook_input["kwargs"])
3.726 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3.726 File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 178, in prepare_metadata_for_build_wheel
3.726 whl_basename = backend.build_wheel(metadata_directory, config_settings)
3.726 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3.726 File "/tmp/pip-build-env-ynab7s0d/overlay/lib/python3.12/site-packages/hatchling/build.py", line 58, in build_wheel
3.726 return os.path.basename(next(builder.build(directory=wheel_directory, versions=['standard'])))
3.726 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3.726 File "/tmp/pip-build-env-ynab7s0d/overlay/lib/python3.12/site-packages/hatchling/builders/plugin/interface.py", line 90, in build
3.726 self.metadata.validate_fields()
3.726 File "/tmp/pip-build-env-ynab7s0d/overlay/lib/python3.12/site-packages/hatchling/metadata/core.py", line 265, in validate_fields
3.726 _ = self.version
3.726 ^^^^^^^^^^^^
3.726 File "/tmp/pip-build-env-ynab7s0d/overlay/lib/python3.12/site-packages/hatchling/metadata/core.py", line 149, in version
3.726 self._version = self._get_version()
3.726 ^^^^^^^^^^^^^^^^^^^
3.726 File "/tmp/pip-build-env-ynab7s0d/overlay/lib/python3.12/site-packages/hatchling/metadata/core.py", line 248, in _get_version
3.726 version = self.hatch.version.cached
3.726 ^^^^^^^^^^^^^^^^^^^^^^^^^
3.726 File "/tmp/pip-build-env-ynab7s0d/overlay/lib/python3.12/site-packages/hatchling/metadata/core.py", line 1456, in cached
3.726 raise type(e)(message) from None
3.726 LookupError: Error getting the version from source `vcs`: setuptools-scm was unable to detect version for /usr/src/app.
3.726
3.726 Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.
3.726
3.726 For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj
3.726
3.726 Alternatively, set the version with the environment variable SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${NORMALIZED_DIST_NAME} as described in https://setuptools-scm.readthedocs.io/en/latest/config.
3.726 [end of output]
3.726
3.726 note: This error originates from a subprocess, and is likely not a problem with pip.
3.735 error: metadata-generation-failed
3.735
3.735 × Encountered error while generating package metadata.
3.735 ╰─> See above for output.
For now, I've improved Dockerfile according to my best knowledge:
- https://github.com/Diaoul/subliminal/pull/1248
It does build here locally now
Created workflow too:
- https://github.com/glensc/subliminal/tree/docker-ci-build
Example run:
- https://github.com/glensc/subliminal/actions/runs/14212451329
Example published images:
- https://github.com/glensc/subliminal/pkgs/container/subliminal/386735936?tag=docker-ci-build
Requires this PR to be merged first:
- https://github.com/Diaoul/subliminal/pull/1248
Dockerfile was not updated when we switched to hatch-vcs for versioning so it was just broken.
Thanks for the PR!
Regarding the GHA for deploying the docker container, what I understand is that it tests if the Dockerfile is building and then deploy it to docker containers website, correct?
For deploying we need to link this repo with docker, only @Diaoul can do that...
Added the github actions:
- https://github.com/Diaoul/subliminal/pull/1251
but it publishes to github container registry, not docker.io. i think that's not a problem, just need to update readme after release and verifying images are ok.
Maybe I should then deprecate this very old docker repository?
@Diaoul we can keep both if we want. The gha that @glensc wrote can send the build to docker also. For that the docker credentials need to be integrated with Github (maybe that's already the case).
The only secret is PYPI_TOKEN so I don't think so. GitHub Actions did not exist when I created the first docker images 😬
😄 It's not too hard to configure anyway: https://docs.docker.com/guides/gha/#configure-your-github-repository
But does it make sense to upload the build on 2 repositories? Maybe it makes sense to keep the DockerHub repo for visibility, what do you think?
No strong opinion, I've seen several projects push on both. Some ppl prefer ghcr because it does not come with the same rate limiting issues as dockerhub 🤷
If we go the dockerhub way, we should create a dockerhub account that is not my personal one and more an "org" one for subliminal.
I think noone uses my dockerhub image anymore but maybe I'm wrong?
Edit: I checked, last pull "less than 1h ago" so we should likely go through a proper deprecation notice
Ok thanks, if the name needs to changed anyway, it's better if it's deprecated then, in favor of ghcr.io.
I made a PR to change the README to say that the docker builds are on ghcr.io: https://github.com/Diaoul/subliminal/pull/1252
I left feedback to doc change (it's incomplete):
- https://github.com/Diaoul/subliminal/pull/1252/files#r2037403774