diff --git a/compresstozip/Dockerfile b/compresstozip/Dockerfile new file mode 100644 index 0000000..d54600f --- /dev/null +++ b/compresstozip/Dockerfile @@ -0,0 +1,23 @@ +ARG BASEIMAGE + +FROM ${BASEIMAGE} + +RUN addgroup --system nonroot && \ + adduser --system \ + --ingroup nonroot \ + --home /home/nonroot \ + nonroot + +ENV HOME=/home/nonroot +ENV VENV_PATH=$HOME/venv +ENV PATH=$VENV_PATH/bin:$PATH +USER nonroot + +RUN python -m venv "$VENV_PATH" --system-site-packages + +RUN pip install uv +RUN uv pip install urgap["all"] + +WORKDIR $HOME + +ENTRYPOINT ["uctl", "run", "upi-server", "-n", "CompressToZip:1.0.0", "-n", "CompressToZip:latest"] diff --git a/compresstozip/tests/test_compresstozip.py b/compresstozip/tests/test_compresstozip.py new file mode 100644 index 0000000..516bc5d --- /dev/null +++ b/compresstozip/tests/test_compresstozip.py @@ -0,0 +1,63 @@ +"""Basic tests for compresstozip container.""" + + +import subprocess + + +def test_python_available(): + """Test that Python is available and runs.""" + result = subprocess.run( + ["python", "--version"], + capture_output=True, + text=True, + ) + assert result.returncode == 0 + assert "Python" in result.stdout + + +def test_urgap_installed(): + """Test that urgap package is installed.""" + result = subprocess.run( + ["pip3", "show", "urgap"], + capture_output=True, + text=True, + ) + assert result.returncode == 0 + assert "Name: urgap" in result.stdout + + +def test_compresstozip_nodes_registered(): + """Test that CompressToZip nodes are discovered by urgap.""" + result = subprocess.run( + ["python", "-c", + "import urgap; " + "lookup = urgap.instances.unode_manager.wrapper_lookup; " + "print(all(node in lookup for node in [" + "'CompressToZip:1.0.0', 'CompressToZip:latest']))"], + capture_output=True, + text=True, + ) + assert result.returncode == 0 + assert "True" in result.stdout + + +def test_uctl_available(): + """Test that uctl command is available.""" + result = subprocess.run( + ["uctl", "--help"], + capture_output=True, + text=True, + ) + assert result.returncode == 0 + assert "uctl" in result.stdout.lower() or "urgap" in result.stdout.lower() + + +def test_uv_available(): + """Test that uv tool is available.""" + result = subprocess.run( + ["uv", "--version"], + capture_output=True, + text=True, + ) + assert result.returncode == 0 + assert "uv" in result.stdout.lower() diff --git a/package-information.json b/package-information.json index 84784c6..b9b488a 100644 --- a/package-information.json +++ b/package-information.json @@ -14,6 +14,13 @@ "base_image": "python:3.13-slim-trixie", "gh_url": "urgap/urgap.git", "separate_venv": false + }, + { + "name": "compresstozip", + "versions": ["1.0.0"], + "base_image": "python:3.10", + "gh_url": "urgap/urgap.git", + "separate_venv": false } ] }