FreeCAD Docker CLI mode: Difference between revisions

From FreeCAD Documentation
(Create page of FreeCAD CLI docker)
 
No edit summary
(11 intermediate revisions by 4 users not shown)
Line 2: Line 2:
{{UnfinishedDocu}}
{{UnfinishedDocu}}
<translate>
<translate>
{{[[Compile on MacOS|Compile on MacOS]]
|[[Compiling (Speeding up)|Compiling (Speeding up)]]
}}


<!--T:299-->
==Overview==
{{Docnav
|[[Compile_on_Docker|Compile on Docker]]
|[[Compiling_(Speeding_up)|Compiling (Speeding up)]]
}}


</translate>
</translate>
Line 12: Line 13:
<translate>
<translate>


==Overview== <!--T:308-->
Docker image of FreeCAD compiled without GUI. This docker image is especially for developers who only want to use FreeCAD in the command-line interface (CLI) and want to FreeCAD as a CAD engine for their web applications.


<!--T:309-->
===Benefits===
Docker image of FreeCAD compiled without GUI. This Docker image is especially for developers who only want to use FreeCAD in the command-line interface (CLI).


===Benefits=== <!--T:310-->

<!--T:311-->
All of FreeCAD's dependencies are already installed, compatible with each other, and configured appropriately, allowing you to get started developing very quickly.
All of FreeCAD's dependencies are already installed, compatible with each other, and configured appropriately, allowing you to get started developing very quickly.
* Easy to use and lightweight.
* Easy to use and lightweight.
Line 21: Line 26:
* No need to add FreeCAD paths to import it into Python.
* No need to add FreeCAD paths to import it into Python.


==Docker Repository==
==Docker Repository== <!--T:312-->


<!--T:313-->
* Docker Hub: https://hub.docker.com/r/amrit3701/freecad-cli
* Docker Hub: https://hub.docker.com/r/amrit3701/freecad-cli
* Github repo: https://github.com/amrit3701/docker-freecad-cli
* Github repository: https://github.com/amrit3701/docker-freecad-cli


==Prerequisites==
==Prerequisites== <!--T:314-->


<!--T:307-->
<!--T:307-->
Line 32: Line 38:
* Docker
* Docker


==Installation==
==Installation== <!--T:315-->


<!--T:316-->
# Pull the Docker image.</translate>{{Code|lang=bash|code=
# Pull the Docker image.</translate>{{Code|lang=bash|code=
docker pull amrit3701/freecad-cli:latest
docker pull amrit3701/freecad-cli:latest
}}<translate>
}}<translate>

# When you successfully pulled docker image, now you can run image.</translate>{{Code|lang=bash|code=
<!--T:317-->
# When you successfully pulled Docker image, now you can run image.</translate>{{Code|lang=bash|code=
docker run -it amrit3701/freecad-cli:lastest bash
docker run -it amrit3701/freecad-cli:lastest bash
}}
}}
Line 43: Line 52:
<translate>
<translate>


==Additional information==
==Additional information== <!--T:318-->


===Extend docker image===
===Extend Docker image=== <!--T:319-->


<!--T:320-->
You can also extend this docker images to add additional dependencies for your project. For eg
You can also extend this Docker images to add additional dependencies for your project. For eg
</translate>
</translate>
{{Code|lang=docker|code=
{{Code|lang=docker|code=
Line 53: Line 63:
# Dockerfile
# Dockerfile


FROM amrit3701/freecad-cli:lastest bash
FROM amrit3701/freecad-cli:lastest


# Add additional dependencies
# Add additional dependencies


# pip3.7 install <some_package>
# pip3.8 install <some_package>
}}
}}
<translate>
<translate>


===Import FreeCAD in Python===
===Import FreeCAD in Python=== <!--T:321-->


<!--T:322-->
After running docker image, just run <code>Python</code>.
After running Docker image, just run <code>Python</code>.
</translate>
</translate>


{{Code|lang=bash|code=
{{Code|lang=bash|code=
$ docker run -it amrit3701/freecad-cli:lastest bash
$ docker run -it amrit3701/freecad-cli:lastest bash
root@f0ec904cf9b9:/# python3.7
root@f0ec904cf9b9:/# python3.8
Python 3.7.7 (default, Mar 10 2020, 17:25:08)
Python 3.8.5 (default, Jul 20 2020, 19:48:14)
[GCC 5.4.0 20160609] on linux
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Type "help", "copyright", "credits" or "license" for more information.
>>> import FreeCAD
>>> import FreeCAD
Line 78: Line 89:
}}
}}
<translate>
<translate>
===Launch FreeCADCmd===
To launch FreeCAD inside docker image, just run <code>FreeCADCmd</code> command.


===Launch FreeCADCmd=== <!--T:326-->
==Discussion==


<!--T:323-->
To launch FreeCAD inside Docker image, just run <code>FreeCADCmd</code> command.

==Discussion== <!--T:324-->

<!--T:325-->
FreeCAD forum thread: https://forum.freecadweb.org/viewtopic.php?f=8&t=45877
FreeCAD forum thread: https://forum.freecadweb.org/viewtopic.php?f=8&t=45877


<!--T:327-->
{{Docnav
|[[Compile_on_Docker|Compile on Docker]]
|[[Compiling_(Speeding_up)|Compiling (Speeding up)]]
}}

</translate>
</translate>

Revision as of 14:54, 29 October 2021

This documentation is not finished. Please help and contribute documentation.

GuiCommand model explains how commands should be documented. Browse Category:UnfinishedDocu to see more incomplete pages like this one. See Category:Command Reference for all commands.

See WikiPages to learn about editing the wiki pages, and go to Help FreeCAD to learn about other ways in which you can contribute.

Overview

Docker image of FreeCAD compiled without GUI. This Docker image is especially for developers who only want to use FreeCAD in the command-line interface (CLI).

Benefits

All of FreeCAD's dependencies are already installed, compatible with each other, and configured appropriately, allowing you to get started developing very quickly.

  • Easy to use and lightweight.
  • It gives better performance in terms of speed.
  • No need to add FreeCAD paths to import it into Python.

Docker Repository

Prerequisites

  • 3 GB of free storage
  • Docker

Installation

  1. Pull the Docker image.
    docker pull amrit3701/freecad-cli:latest
    
  2. When you successfully pulled Docker image, now you can run image.
    docker run -it amrit3701/freecad-cli:lastest bash
    


Additional information

Extend Docker image

You can also extend this Docker images to add additional dependencies for your project. For eg

# Dockerfile

FROM amrit3701/freecad-cli:lastest

# Add additional dependencies

# pip3.8 install <some_package>

Import FreeCAD in Python

After running Docker image, just run Python.

$ docker run -it amrit3701/freecad-cli:lastest bash
root@f0ec904cf9b9:/# python3.8
Python 3.8.5 (default, Jul 20 2020, 19:48:14)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import FreeCAD
>>> import Part
>>> import Draft
>>> import Arch

Launch FreeCADCmd

To launch FreeCAD inside Docker image, just run FreeCADCmd command.

Discussion

FreeCAD forum thread: https://forum.freecadweb.org/viewtopic.php?f=8&t=45877