-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from maexled/docker
Added Dockerfile
- Loading branch information
Showing
7 changed files
with
125 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Create and publish a Docker image on Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
branches: | ||
- 'master' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Container registry | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM python:3.9-slim-buster | ||
|
||
WORKDIR /camera | ||
|
||
COPY requirements.txt ./ | ||
|
||
RUN apt update && \ | ||
apt upgrade -y && \ | ||
apt install ffmpeg zip curl -y && \ | ||
pip install --no-cache-dir --upgrade pip && \ | ||
pip install --no-cache-dir -r requirements.txt && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
COPY . . | ||
RUN mkdir files | ||
|
||
CMD ["bash", "move.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,68 @@ | ||
### About the Project | ||
## About the Project | ||
The project is designed to manage images uploaded by a (Hikvision) IP-Camera in a folder using FTP. The images in the `temp/` Folder are moved by the `move.sh` script in the right folder named by it's current date. Every night should be the `raffer.sh` script automatically started to render the images to one full video. Optionally the videos are uploaded to specific nextcloud server, configurable in `config.cfg` | ||
|
||
### Prerequisites | ||
## Prerequisites | ||
|
||
* ffmpeg | ||
```sh | ||
sudo apt install ffmpeg | ||
* python3 | ||
|
||
### Installation | ||
## Installation | ||
### Be stupid and do it with bash | ||
|
||
1. Clone the repo | ||
```sh | ||
git clone https://github.com/maexled/camera-images-bash-manager.git | ||
cd camera-images-bash-manager/ | ||
``` | ||
2. Create files folder | ||
3. Install needed python libraries | ||
```sh | ||
pip install -r requirements.txt | ||
``` | ||
3. Create files folder | ||
```sh | ||
mkdir files | ||
``` | ||
3. Define variables in `config.cfg` | ||
4. Define variables in `config.cfg` | ||
```bash | ||
fps="10" | ||
samba_user="samba" | ||
object_detection="true" | ||
save_longtime_pictures="true" | ||
save_object_detection="true" | ||
save_to_nextcloud="true" | ||
nextcloud_host="https://yournextcloud.com" | ||
nextcloud_path="Videos" | ||
nextcloud_username="Maexled" | ||
nextcloud_password="YourSecretPassword" | ||
4. Start `move.sh` in screen | ||
fps="10" | ||
raffer_execution="00:15" | ||
samba_user="samba" | ||
object_detection="true" | ||
save_longtime_pictures="true" | ||
save_object_detection="true" | ||
save_to_nextcloud="true" | ||
nextcloud_host="https://yournextcloud.com" | ||
nextcloud_path="Videos" | ||
nextcloud_username="Maexled" | ||
nextcloud_password="YourSecretPassword" | ||
``` | ||
- `samba_user` - is the user who will own the moved files | ||
- `raffer_execution` - if you want to execute raffer in other ways (e.g cron), keep it empty | ||
|
||
The other variables should be self-explanatory | ||
|
||
5. Start `move.sh` in screen | ||
```sh | ||
bash move.sh | ||
``` | ||
5. Create crontab for `raffer.sh`, for example crontab -e | ||
6. Create crontab for `raffer.sh`, for example crontab -e | ||
```sh | ||
15 0 * * * bash /camera/raffer.sh | ||
``` | ||
This will execute everyday 00:15 the raffer script makes the video then. | ||
|
||
### Be smart and do it with docker! | ||
```sh | ||
docker run \ | ||
--name camera-images-manager \ | ||
-v /home/max/cameratest/files:/camera/files \ | ||
-v /home/max/cameratest/temp:/camera/temp \ | ||
-v /home/max/cameratest/config.cfg:/camera/config.cfg \ | ||
-e TZ=Europe/Berlin \ | ||
camera-images-bash | ||
``` | ||
#### Configuration variables in config.cfg: | ||
- `samba_user` - recommened to set it as root. In container no extra user will be created. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
fps="10" | ||
raffer_execution="00:15" | ||
samba_user="samba" | ||
object_detection="true" | ||
longtime_pictures="true" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
numpy==1.22.4 | ||
imutils==0.5.4 | ||
opencv-python==4.5.5.64 |