-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding an official docker image for Bambu Connect!
- Loading branch information
1 parent
ef50344
commit fb2d46d
Showing
10 changed files
with
400 additions
and
9 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,60 @@ | ||
name: Publish Docker image | ||
|
||
# Only make and deploy new docker images on tagged releases. | ||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
# This is needed for the attestation step | ||
id-token: write | ||
attestations: write | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
# Required for docker multi arch building. | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
# Required for docker multi arch building. | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: octoeverywhere/octoeverywhere | ||
|
||
- name: Build and push Docker image | ||
id: push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
# These are the platform our ubuntu image base supports | ||
platforms: linux/amd64,linux/arm/v7,linux/arm64 | ||
file: ./Dockerfile | ||
push: true | ||
tags: octoeverywhere/octoeverywhere:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
# This isn't working, so it's disabled for now. | ||
# - name: Generate artifact attestation | ||
# uses: actions/attest-build-provenance@v1 | ||
# with: | ||
# subject-name: octoeverywhere/octoeverywhere | ||
# subject-digest: ${{ steps.push.outputs.digest }} | ||
# push-to-registry: 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,37 @@ | ||
# Start with the lastest ubuntu, for a solid base, | ||
# since we need some advance binaries for things like pillow and ffmpeg. | ||
FROM ubuntu:latest | ||
|
||
# We will base ourselves in root, becuase why not. | ||
WORKDIR /root | ||
|
||
# Define some user vars we will use for the image. | ||
# These are read in the docker_octoeverywhere module, so they must not change! | ||
ENV USER=root | ||
ENV REPO_DIR=/root/octoeverywhere | ||
ENV VENV_DIR=/root/octoeverywhere-env | ||
# This is a special dir that the user MUST mount to the host, so that the data is persisted. | ||
# If this is not mounted, the printer will need to be re-linked everytime the container is remade. | ||
ENV DATA_DIR=/data/ | ||
|
||
# Install the required packages. | ||
# Any packages here should be mirrored in the install script - and any optaionl pillow packages done inline. | ||
RUN apt update | ||
RUN apt install -y curl ffmpeg jq python3 python3-pip python3-venv virtualenv libjpeg-dev zlib1g-dev python3-pil python3-pillow | ||
|
||
# | ||
# We decided to not run the installer, since the point of the installer is to setup the env, build the launch args, and setup the serivce. | ||
# Instead, we will manually run the smaller subset of commands that are requred to get the env setup in docker. | ||
# Note that if this ever becomes too much of a hassle, we might want to revert back to using the installer, and supporting a headless install. | ||
# | ||
RUN virtualenv -p /usr/bin/python3 ${VENV_DIR} | ||
RUN ${VENV_DIR}/bin/python -m pip install --upgrade pip | ||
|
||
# Copy the entire repo into the image, do this as late as possible to avoid rebuilding the image everytime the repo changes. | ||
COPY ./ ${REPO_DIR}/ | ||
RUN ${VENV_DIR}/bin/pip3 install --require-virtualenv --no-cache-dir -q -r ${REPO_DIR}/requirements.txt | ||
|
||
# For docker, we use our docker_octoeverywhere host to handle the runtime setup and launch of the serivce. | ||
WORKDIR ${REPO_DIR} | ||
# Use the full path to the venv, we msut use this [] notation for our ctlc handler to work in the contianer | ||
ENTRYPOINT ["/root/octoeverywhere-env/bin/python", "-m", "docker_octoeverywhere"] |
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,28 @@ | ||
version: '2' | ||
services: | ||
octoeverywhere-bambu-connect: | ||
image: octoeverywhere/octoeverywhere:latest | ||
environment: | ||
# https://octoeverywhere.com/s/access-code | ||
- ACCESS_CODE=XXXXXXXX | ||
# https://octoeverywhere.com/s/bambu-sn | ||
- SERIAL_NUMBER=XXXXXXXXXXXXXXX | ||
# Find using the printer's display | ||
- PRINTER_IP=192.168.1.1 | ||
volumes: | ||
# Specify a path mapping for the required persistent storage | ||
- /some/path/on/your/computer:/data | ||
|
||
# Add as many printers as you want! | ||
# octoeverywhere-bambu-connect-2: | ||
# image: octoeverywhere/octoeverywhere:latest | ||
# environment: | ||
# # https://octoeverywhere.com/s/access-code | ||
# - ACCESS_CODE=XXXXXXXX | ||
# # https://octoeverywhere.com/s/bambu-sn | ||
# - SERIAL_NUMBER=XXXXXXXXXXXXXXX | ||
# # Find using the printer's display | ||
# - PRINTER_IP=192.168.1.2 | ||
# volumes: | ||
# # Specify a path mapping for the required persistent storage | ||
# - /some/path/on/your/computer/printer2:/data |
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,62 @@ | ||
# Bambu Connect Docker Support | ||
|
||
OctoEverywhere's docker image only works for [Bambu Connect](https://octoeverywhere.com/bambu?source=github_docker_readme) for Bambu Lab 3D printers. If you are using OctoPrint or Klipper, [follow our getting started guide](https://octoeverywhere.com/getstarted?source=github_docker_readme) to install the OctoEverywhere plugin. | ||
|
||
Official Docker Image: https://hub.docker.com/r/octoeverywhere/octoeverywhere | ||
|
||
## Required Setup Environment Vars | ||
|
||
To use the Bambu Connect plugin, you need to get the following information. | ||
|
||
- Your printer's Access Code - https://octoeverywhere.com/s/access-code | ||
- Your printer's Serial Number - https://octoeverywhere.com/s/bambu-sn | ||
- Your printer's IP Address - (use the printer's display) | ||
|
||
These three values must be set at environment vars when you first run the container. Once the container is run, you don't need to include them again, unless you want to update the values. | ||
|
||
- ACCESS_CODE=(code) | ||
- SERIAL_NUMBER=(serial number) | ||
- PRINTER_IP=(ip address) | ||
|
||
## Required Persistent Storage | ||
|
||
You must map the `/data` folder in your docker container to a directory on your computer so the plugin can write data that will remain between runs. Failure to do this will require relinking the plugin when the container is destroyed or updated. | ||
|
||
## Linking Your Bambu Connect Plugin | ||
|
||
Once the docker container is running, you need to look at the logs to find the linking URL. | ||
|
||
Docker Compose: | ||
`docker-compose logs | grep https://octoeverywhere.com/getstarted` | ||
|
||
Docker: | ||
`docker logs bambu-connect | grep https://octoeverywhere.com/getstarted` | ||
|
||
# Running The Docker Image | ||
|
||
## Using Docker Compose | ||
|
||
Using docker compose is the easiest way to run OctoEverywhere's Bambu Connect using docker. | ||
|
||
- Install [Docker and Docker Compose](https://docs.docker.com/compose/install/linux/) | ||
- Clone this repo | ||
- Edit the `./docker-compose.yml` file to enter your environment vars | ||
- Run `docker-compose up -d` | ||
- Follow the "Linking Your Bambu Connect Plugin" to link the plugin to your account. | ||
|
||
## Using Docker | ||
|
||
Docker compose is a fancy wrapper to run docker containers. You can also run docker containers manually. | ||
|
||
Use a command like this example, but update the required vars. | ||
|
||
`docker pull octoeverywhere/octoeverywhere` | ||
`docker run --name bambu-connect -e ACCESS_CODE=<code> -e SERIAL_NUMBER=<serial number> -e PRINTER_IP=<ip address> -v /your/local/path:/data -d octoeverywhere/octoeverywhere` | ||
|
||
Follow the "Linking Your Bambu Connect Plugin" to link the plugin to your account. | ||
|
||
## Building The Image Locally | ||
|
||
You can build the docker image locally if you prefer, use the following command. | ||
|
||
`docker build -t octoeverywhere .` |
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 @@ | ||
# Need to make this a module |
Oops, something went wrong.