diff --git a/.github/ISSUE_TEMPLATE/-add--feature-request.md b/.github/ISSUE_TEMPLATE/-add--feature-request.md new file mode 100644 index 0000000..ad18475 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/-add--feature-request.md @@ -0,0 +1,20 @@ +--- +name: "[ADD] Feature request" +about: Suggest an idea for this project +title: "[ADD] " +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/-bug--.md b/.github/ISSUE_TEMPLATE/-bug--.md new file mode 100644 index 0000000..756f46f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/-bug--.md @@ -0,0 +1,30 @@ +--- +name: "[BUG] " +about: Create a report to help us improve +title: "[BUG] " +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Environment** + +**Additional context** +Add any other context about the problem here. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e044475 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,62 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# GitHub recommends pinning actions to a commit SHA. +# To get a newer version, you will need to update the SHA. +# You can also reference a tag or branch, but the action may change without warning. + +name: Create and publish Docker image + +on: + push: + branches: [ 'bambu' ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + environment: production + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to the Container registry + 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: Set up QEMU + uses: docker/setup-qemu-action@master + with: + platforms: all + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@master + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5042698 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM python:3.9-slim + +WORKDIR /app + +# Klonen des neuesten Codes aus dem GitHub Repository +RUN apt-get update \ + && apt-get install -y git libjpeg-dev zlib1g-dev gcc \ + && git clone -b bambu https://github.com/synman/webcamd.git /app \ + && apt-get purge -y --auto-remove git \ + && rm -rf /var/lib/apt/lists/* + +# Installieren der benötigten Python-Bibliothek +RUN pip install --upgrade pip +RUN pip install pillow + +# Expose the default port for the HTTP server +EXPOSE 8080 + +# Verwendung eines Inline-Shell-Skripts zur kontrollierten Übergabe von Umgebungsvariablen +CMD exec python webcam.py \ + --hostname "${HOSTNAME:-localhost}" \ + $( [ -n "${PASSWORD}" ] && echo "--password ${PASSWORD}" ) \ + $( [ -n "${WIDTH}" ] && echo "--width ${WIDTH}" ) \ + $( [ -n "${HEIGHT}" ] && echo "--height ${HEIGHT}" ) \ + $( [ -n "${IPV}" ] && echo "--ipv ${IPV}" ) \ + $( [ -n "${V4BINDADDRESS}" ] && echo "--v4bindaddress ${V4BINDADDRESS}" ) \ + $( [ -n "${V6BINDADDRESS}" ] && echo "--v6bindaddress ${V6BINDADDRESS}" ) \ + $( [ -n "${PORT}" ] && echo "--port ${PORT}" ) \ + $( [ -n "${ENCODEWAIT}" ] && echo "--encodewait ${ENCODEWAIT}" ) \ + $( [ -n "${STREAMWAIT}" ] && echo "--streamwait ${STREAMWAIT}" ) \ + $( [ -n "${ROTATE}" ] && echo "--rotate ${ROTATE}" ) \ + $( [ -n "${SHOWFPS}" ] && echo "--showfps" ) \ + $( [ -n "${LOGHTTP}" ] && echo "--loghttp" ) \ No newline at end of file diff --git a/README.md b/README.md index 932b6bf..b388fa9 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,12 @@ In addition to Christopher RYU's baseline additio Bambu Printer support is based on proof of concept work found in bambulab/BambuStudio#1536 (comment) that were later optimized in [pybambu](https://github.com/greghesp/pybambu). +## Docker installation +1. Clone this repository `git clone -b bambu https://github.com/MrDrache333/webcamd` +2. Change Environment Parameters in `docker-compose.yml` +3. Start up the Container with `docker-compose up -d` + + ## Dependencies ``` pip install pillow diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e567088 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +version: '3.5' + +services: + webcam: + build: . + environment: + HOSTNAME: "192.168.178.X" + PASSWORD: "1234567890" + WIDTH: 1920 + HEIGHT: 1080 + IPV: 4 + V4BINDADDRESS: 0.0.0.0 + V6BINDADDRESS: "::" + PORT: 8080 + ENCODEWAIT: "" + STREAMWAIT: "" + ROTATE: 0 + SHOWFPS: "false" + LOGHTTP: "false" + ports: + - "8080:8080"