Skip to content

Commit

Permalink
feat: migrate docs (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Jun 9, 2024
1 parent d053d15 commit 1e62ec2
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 155 deletions.
3 changes: 2 additions & 1 deletion .bin/update-release-cache
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -o errexit
set -o pipefail
set -o nounset

unifi-protect release-versions
poetry install
poetry run uiprotect release-versions
32 changes: 0 additions & 32 deletions .bin/update-requirements

This file was deleted.

2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"onCreateCommand": [
"/bin/bash",
"-c",
"sudo -E HOME=/root uv pip install -e '.[dev]' && /usr/local/bin/unifi-protect --install-completion bash && docker-fix"
"sudo -E HOME=/root uv pip install -e '.[dev]' && /usr/local/bin/uiprotect --install-completion bash && docker-fix"
],
"updateContentCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set -o errexit
set -o pipefail
set -o nounset

/usr/local/bin/unifi-protect "$@"
/usr/local/bin/uiprotect "$@"
16 changes: 8 additions & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@ jobs:
- name: Get current version (rebuild)
if: ${{ inputs.rebuild == 'yes' }}
run: |
PYUFP_VERSION=$(git describe --tags --abbrev=0)
UIPROTECT_VERSION=$(git describe --tags --abbrev=0)
echo "PYUFP_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "DOCKER_TAGS=ghcr.io/uilibs/uiprotect:dev,ghcr.io/uilibs/uiprotect:$PYUFP_VERSION" >> $GITHUB_ENV
echo "UIPROTECT_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "DOCKER_TAGS=ghcr.io/uilibs/uiprotect:dev,ghcr.io/uilibs/uiprotect:$UIPROTECT_VERSION" >> $GITHUB_ENV
- name: Get current version (no rebuild)
if: ${{ inputs.rebuild != 'yes' }}
run: |
PYUFP_VERSION=v$(python -c 'from importlib.metadata import version; print(version("uiprotect"))')
UIPROTECT_VERSION=v$(python -c 'from importlib.metadata import version; print(version("uiprotect"))')
echo "PYUFP_VERSION=$PYUFP_VERSION" >> $GITHUB_ENV
echo "DOCKER_TAGS=ghcr.io/uilibs/uiprotect:dev,ghcr.io/uilibs/uiprotect:$(echo $PYUFP_VERSION | tr "+" -)" >> $GITHUB_ENV
echo "UIPROTECT_VERSION=$UIPROTECT_VERSION" >> $GITHUB_ENV
echo "DOCKER_TAGS=ghcr.io/uilibs/uiprotect:dev,ghcr.io/uilibs/uiprotect:$(echo $UIPROTECT_VERSION | tr "+" -)" >> $GITHUB_ENV
- name: Add Latest Docker Tag
run: |
if [[ ! "$PYUFP_VERSION" == *"dev"* ]]; then
if [[ ! "$UIPROTECT_VERSION" == *"dev"* ]]; then
echo "DOCKER_TAGS=ghcr.io/uilibs/uiprotect:latest,$DOCKER_TAGS" >> $GITHUB_ENV
fi
Expand All @@ -91,7 +91,7 @@ jobs:
target: prod
push: true
build-args: |
PYUFP_VERSION=${{ env.PYUFP_VERSION }}
UIPROTECT_VERSION=${{ env.UIPROTECT_VERSION }}
cache-from: ghcr.io/uilibs/uiprotect:buildcache
cache-to: type=registry,ref=ghcr.io/uilibs/uiprotect:buildcache,mode=max
tags: ${{ env.DOCKER_TAGS }}
57 changes: 0 additions & 57 deletions .github/workflows/docs.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{
"label": "Generate Sample Data",
"type": "shell",
"command": "unifi-protect generate-sample-data -w ${input:sampleTime} ${input:sampleAnonymize}",
"command": "uiprotect generate-sample-data -w ${input:sampleTime} ${input:sampleAnonymize}",
"problemMatcher": [],
"options": {
"env": {
Expand All @@ -39,7 +39,7 @@
{
"label": "Regenerate Release Cache",
"type": "shell",
"command": "unifi-protect release-versions",
"command": "uiprotect release-versions",
"problemMatcher": [],
},
],
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ RUN --mount=type=cache,mode=0755,id=pip-$TARGETPLATFORM,target=/root/.cache \

FROM base as prod

ARG PYUFP_VERSION
ARG UIPROTECT_VERSION

COPY --from=builder /usr/local/bin/ /usr/local/bin/
COPY --from=builder /usr/local/lib/python3.12/ /usr/local/lib/python3.12/
RUN --mount=source=.,target=/tmp/uiprotect,type=bind,readwrite \
--mount=type=cache,mode=0755,id=pip-$TARGETPLATFORM,target=/root/.cache \
SETUPTOOLS_SCM_PRETEND_VERSION=${PYUFP_VERSION} uv pip install -U "/tmp/uiprotect[tz]" \
SETUPTOOLS_SCM_PRETEND_VERSION=${UIPROTECT_VERSION} uv pip install -U "/tmp/uiprotect[tz]" \
&& cp /tmp/uiprotect/.docker/entrypoint.sh /usr/local/bin/entrypoint \
&& chmod +x /usr/local/bin/entrypoint \
&& mkdir /data \
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pip install git+https://github.com/uilibs/uiprotect.git#egg=uiprotect
A Docker container is also provided so you do not need to install/manage Python as well. You can add the following to your `.bashrc` or similar.

```bash
function unifi-protect() {
function uiprotect() {
docker run --rm -it \
-e UFP_USERNAME=YOUR_USERNAME_HERE \
-e UFP_PASSWORD=YOUR_PASSWORD_HERE \
Expand Down Expand Up @@ -164,8 +164,8 @@ export UFP_PORT=443
# change to false if you do not have a valid HTTPS Certificate for your instance
export UFP_SSL_VERIFY=True

unifi-protect --help
unifi-protect nvr
uiprotect --help
uiprotect nvr
```

### Python
Expand Down
Loading

0 comments on commit 1e62ec2

Please sign in to comment.