Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Docker support. #1004

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM debian:buster

MAINTAINER S. Utku DARILMAZ <utkudarilmaz@gmail.com>

LABEL desription="Pronterface, Pronsole, and Printcore Docker image."
LABEL version="1.0"

RUN apt update && \
apt install -y git python3 python3-venv python3-pip python3-serial \
python3-numpy cython3 python3-libxml2 python3-gi python3-dbus \
python3-psutil python3-cairosvg libpython3-dev python3-appdirs \
python3-wxgtk4.0 && \
apt clean && \
rm -rf /var/lib/apt/lists/*

COPY . /root/Printrun

WORKDIR /root/Printrun

ENTRYPOINT ["python3"]
CMD ["pronterface.py"]
71 changes: 62 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ A precompiled version is available at http://koti.kapsi.fi/~kliment/printrun/

A precompiled version is available at http://koti.kapsi.fi/~kliment/printrun/

Note for OSX users: if OSX tells you the file is corrupted, you don't need to redownload it. Instead, you need to allow OSX to run unsigned apps. To do this, run
Note for OSX users: if OSX tells you the file is corrupted, you don't need to redownload it. Instead, you need to allow OSX to run unsigned apps. To do this, run
`sudo spctl --master-disable`


Expand All @@ -31,15 +31,15 @@ Note for OSX users: if OSX tells you the file is corrupted, you don't need to re

There is currently no package for Printrun 2. It must be [run from source](https://github.com/kliment/Printrun/tree/master#running-from-source).

### Chrome OS
### Chrome OS

You can use Printrun via crouton ( https://github.com/dnschneid/crouton ). Assuming you want Ubuntu Trusty, you used probably `sudo sh -e ~/Downloads/crouton -r trusty -t xfce` to install Ubuntu. Fetch and install printrun with the line given above for Ubuntu/Debian.

By default you have no access to the serial port under Chrome OS crouton, so you cannot connect to your 3D printer. Add yourself to the serial group within the linux environment to fix this

`sudo usermod -G serial -a <username>`
`sudo usermod -G serial -a <username>`

where `<username>` should be your username. Log out and in to make this group change active and allow communication with your printer.
where `<username>` should be your username. Log out and in to make this group change active and allow communication with your printer.

### Fedora

Expand Down Expand Up @@ -78,7 +78,7 @@ To use pronterface, you need:
* numpy (for 3D view)
* pycairo (to use Projector feature)
* cairosvg (to use Projector feature)
* dbus (to inhibit sleep on some Linux systems)
* dbus (to inhibit sleep on some Linux systems)

### Use Python virtual environment

Expand Down Expand Up @@ -158,6 +158,60 @@ $ brew install python3

And follow the above **Python virtual environment** section. You don't need to search for wxPython wheel, macOS wheels are available from the Python Package Index.

### Docker

You can use the Printrun utilities inside of Docker container.

```console
git clone https://github.com/kliment/Printrun.git
cd Printrun

docker build -t printrun:latest .

docker run -ti --rm \
--device /dev/ttyUSB0 \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
printrun:latest
```

> or directly pulling container image

```console
docker run -ti --rm \
--device /dev/ttyUSB0 \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
utkudarilmaz/printrun:latest
```

+ **--device** parameter for connecting the printer via specified device.
+ **-e DISPLAY=$DISPLAY** and **-v /tmp/.X11-unix:/tmp/.X11-unix** parameters
for using pronsole in GUI.

Of course, you can use the Pronsole utility without volume and environment
variable parameters give to container.

On default, if you run container without parameter, Pronterface will be opened.
If you want to run another Printrun utility just give that name to Docker
command's end.

Example:

```console
docker run -ti --rm \
--device /dev/ttyUSB0 \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
utkudarilmaz/printrun:latest pronsole.py
```

**Note:** If you get *"Unable to access the X Display, is $DISPLAY set
properly?"* error you have to run below command on your console.

```console
xhost +si:localuser:root
```

# USING PRINTRUN

Expand Down Expand Up @@ -392,15 +446,15 @@ For example, following macro toggles the diagnostic information similarily to th

Macro parameters are available in '!'-escaped python code as locally defined list variable: arg[0] arg[1] ... arg[N]

All python code is executed in the context of the pronsole (or PronterWindow) object,
All python code is executed in the context of the pronsole (or PronterWindow) object,
so it is possible to use all internal variables and methods, which provide great deal of functionality.
However the internal variables and methods are not very well documented and may be subject of change, as the program is developed.
Therefore it is best to use pronsole commands, which easily contain majority of the functionality that might be needed.

Some useful python-mode-only variables:

```python
!self.settings - contains all settings, e.g.
!self.settings - contains all settings, e.g.
port (!self.settings.port), baudrate, xy_feedrate, e_feedrate, slicecommand, final_command, build_dimensions
You can set them also via pronsole command "set", but you can query the values only via python code.
!self.p - printcore object (see USING PRINTCORE section for using printcore object)
Expand All @@ -411,7 +465,7 @@ Some useful python-mode-only variables:
Some useful methods:

```python
!self.onecmd - invokes raw command, e.g.
!self.onecmd - invokes raw command, e.g.
!self.onecmd("move x 10")
!self.onecmd("!print self.p.loud")
!self.onecmd("button "+self.cur_button+" fanOFF /C cyan M107")
Expand Down Expand Up @@ -481,4 +535,3 @@ along with Printrun. If not, see <http://www.gnu.org/licenses/>.
```

All scripts should contain this license note, if not, feel free to ask us. Please note that files where it is difficult to state this license note (such as images) are distributed under the same terms.