openscad / docker-openscad

OpenSCAD-related docker files
BSD 2-Clause "Simplified" License
12 stars 11 forks source link

Request: Add instructions to the README about how to use the Docker container to do a CLI build #16

Open DeflateAwning opened 1 year ago

DeflateAwning commented 1 year ago

I'm hoping that one of the containers that exists allows me to run something like:

docker run -v /host_path/to/scad-files:/src openscad/openscad openscad /src/file.scad -o /src/file.stl

Does this exist? Would it be possible to add it to the README if it does?

t-paul commented 1 year ago

Hmm, I wrote documentation on using the containers on docker hub, but I can't find that anymore. Maybe that got lost when the account moved to an official open source account or when the github repo got a README.md :disappointed:.

Generate STL/3MF etc, does not need an internal X display, so the simple command line is fine

docker run \
    -it \
    --rm \
    -v $(pwd):/openscad \
    -u $(id -u ${USER}):$(id -g ${USER}) \
    openscad/openscad:latest \
    openscad -o CSG.3mf CSG.scad

For PNG the current build still needs the X display, that limitation can go away soon due to the built-in EGL support. So this needs --init and run via xvfb-run

docker run \
    -it \
    --rm \
    --init \
    -v $(pwd):/openscad \
    -u $(id -u ${USER}):$(id -g ${USER}) \
    openscad/openscad:latest \
    xvfb-run -a openscad -o CSG.png CSG.scad
DeflateAwning commented 1 year ago

This is great stuff! Can you add it to the README also? Would be very very helpful

t-paul commented 1 year ago

Sure, that's why I did not close the issue. I just don't have the time right now and I want to get the builds updated first, so we can get rid of the special case :egl docker build as that is now supported by main line OpenSCAD. That removes the need for that separate xvfb-run wrapper.

DeflateAwning commented 1 year ago

You seem busy! Just threw these instructions in the README :)

t-paul commented 1 year ago

Initial update via #19. Keeping this open as reminder when the (snapshot) images are updated to EGL support.

DeflateAwning commented 1 year ago

It appears that this PR is reflected in the README here, but not on the Docker Hub page: https://hub.docker.com/r/openscad/openscad

Wonder if there's a button you have to turn on to make it sync it or something?