├── .gitattributes ├── .gitignore ├── BUILD.md ├── Dockerfile ├── LICENSE ├── Makefile ├── README.Docker.md ├── README.md ├── RELEASE.md ├── guides ├── README.md ├── nvidia-jetson.md └── raspberry-pi.md ├── linuxcnc-entrypoint.sh └── tools.mak /.gitattributes: -------------------------------------------------------------------------------- 1 | # never add CRLF to shell files! 2 | *.sh text=lf 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .BUILD_NUMBER -------------------------------------------------------------------------------- /BUILD.md: -------------------------------------------------------------------------------- 1 | # Readme 2 | 3 | This document covers the building of the Docker multi-platform images. 4 | 5 | ## Simplified Makefile system 6 | 7 | There is a `Makefile` to ease creating the multi-platform images, bundle them in a release and push them to DockerHub. 8 | 9 | __NOTES:__ 10 | 11 | * Don't forget to update the version in the `Makefile` 12 | * Login to DockerHub before publishing a release or pushing a new image 13 | 14 | ### Build All 15 | 16 | ```bash 17 | $ make 18 | ``` 19 | 20 | ### Build just for linux on amd64 21 | 22 | ```bash 23 | $ make linux/amd64/build 24 | ``` 25 | 26 | ### Build linux on amd64 and run (useful for debugging) 27 | 28 | ```bash 29 | $ make quick 30 | ``` 31 | 32 | ### Release a new build to DockerHub 33 | 34 | ```bash 35 | $ make publish 36 | ``` 37 | 38 | ## Docker image 39 | 40 | __squish__ requires that the Docker experimental settings be enabled. Add the following to `/etc/docker/daemon.json` 41 | 42 | ```json 43 | { 44 | "experimental": true 45 | } 46 | ``` 47 | 48 | The build can be completed without __squish__ but it will result in much larger image. The default will build amd64 based images. 49 | 50 | ```bash 51 | $ docker build --squash -t jeffersonjhunt/linuxcnc . 52 | ``` 53 | 54 | ## Patches 55 | 56 | None 57 | 58 | ## Alternate architectures 59 | 60 | The following instructions are for building platform specific images. The currently supported images (PLATFORM) types are: 61 | 62 | `amd64`, `i386`, `arm32v7`, `arm64v8` 63 | 64 | In theory any platform supported by [Docker](https://github.com/docker-library/official-images#architectures-other-than-amd64 "Alternate Architectures") and [Debian](https://hub.docker.com/_/debian "Debian Platforms") would work, but only the aforementioned ones have been tested. 65 | 66 | ### 32 bit support (i386) 67 | 68 | To build the image requires the additional `--build-arg` to be passed set to `i386`. 69 | 70 | ```bash 71 | $ docker build --squash --build-arg PLATFORM=i386 -t jeffersonjhunt/linuxcnc . 72 | ``` 73 | 74 | ### Raspberry PI (arm32v7) 75 | 76 | In order to build `arm32v7` based containers the build will need to be performed on an Raspberry PI or using Qemu on a Linux machine with [`binfmt-support`](https://en.wikipedia.org/wiki/Binfmt_misc "binfmt"). 77 | 78 | This page [Debian Wiki](https://wiki.debian.org/RaspberryPi/qemu-user-static "Debian Qemu Raspberry") used for creating an Raspbian image for local building/testing goes further than necessary, but provides excellent background information. The minimum supporting packages can be installed with: 79 | 80 | ```bash 81 | $ sudo apt-get update 82 | $ sudo apt-get install qemu-user 83 | $ sudo apt-get install qemu-user-static 84 | ``` 85 | 86 | To build the image requires the additional `--build-arg` to be passed set to `arm32v7`. *__NOTE:__ on an i7-6600 this process takes hours to complete.* 87 | 88 | ```bash 89 | $ docker build --squash --build-arg PLATFORM=arm32v7 -t jeffersonjhunt/linuxcnc . 90 | ``` 91 | 92 | ### NVIDIA Jetson Nano (arm64v8) 93 | 94 | *__NOTE:__ Raspberry PI and PINE64 official support will be added in the near future. PINE64 should work out of the box, but 64 Bit Raspbian is not trivial and requires sourcing a new base distro to test.* 95 | 96 | To cross-compile use the same procedure as the __Raspberry PI (arm32v7)__ setting the `--build-arg` to `arm64v8`. *__NOTE:__ on an i7-6600 this process takes several hours to complete.* 97 | 98 | __Instead of cross-compiling building on a `NVIDIA Jetson Nano` is strongly suggested as it is much quicker.__ 99 | 100 | ```bash 101 | $ docker build --squash --build-arg PLATFORM=arm64v8 -t jeffersonjhunt/linuxcnc . 102 | ``` 103 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG PLATFORM=amd64 2 | FROM ${PLATFORM}/debian:stable-20190812-slim 3 | LABEL maintainer "Jefferson J. Hunt " 4 | 5 | ENV DEBIAN_FRONTEND noninteractive 6 | 7 | # Ensure that we always use UTF-8, US English locale and UTC time 8 | RUN apt-get update && apt-get install -y locales && \ 9 | localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \ 10 | echo "UTC" > /etc/timezone && \ 11 | chmod 0755 /etc/timezone 12 | ENV LANG en_US.utf8 13 | ENV LC_ALL=en_US.utf-8 14 | ENV LANGUAGE=en_US:en 15 | ENV PYTHONIOENCODING=utf-8 16 | 17 | # Install supporting apps needed to build/run 18 | RUN apt-get install -y \ 19 | git \ 20 | build-essential \ 21 | pkg-config \ 22 | curl \ 23 | autogen \ 24 | autoconf \ 25 | python \ 26 | python-tk \ 27 | libudev-dev \ 28 | libmodbus-dev \ 29 | libusb-1.0-0-dev \ 30 | libgtk2.0-dev \ 31 | python-gtk2 \ 32 | procps \ 33 | kmod \ 34 | intltool \ 35 | tcl8.6-dev \ 36 | tk8.6-dev \ 37 | bwidget \ 38 | libtk-img \ 39 | tclx \ 40 | libreadline-gplv2-dev \ 41 | libboost-python-dev \ 42 | libglu1-mesa-dev \ 43 | libgl1-mesa-dev \ 44 | libxmu-dev \ 45 | python-yapps \ 46 | yapps2 && \ 47 | curl -k https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py && \ 48 | python /tmp/get-pip.py && \ 49 | pip install --upgrade pip 50 | 51 | WORKDIR /opt 52 | 53 | # Add modules/plugins 54 | 55 | # Build and install LinuxCNC 56 | RUN git clone https://github.com/LinuxCNC/linuxcnc.git && \ 57 | cd linuxcnc/debian && \ 58 | ./configure uspace && \ 59 | cd ../src && \ 60 | ./autogen.sh && \ 61 | ./configure --with-realtime=uspace && \ 62 | make 63 | 64 | # Clean up APT when done. 65 | RUN apt-get purge -y \ 66 | git \ 67 | build-essential \ 68 | pkg-config \ 69 | curl \ 70 | autogen \ 71 | autoconf \ 72 | curl && \ 73 | apt-get autoclean -y && \ 74 | apt-get autoremove -y && \ 75 | rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 76 | 77 | # Add mgmt scripts 78 | COPY linuxcnc-entrypoint.sh /usr/local/bin/linuxcnc-entrypoint.sh 79 | RUN chmod +x /usr/local/bin/linuxcnc-entrypoint.sh 80 | 81 | # Fire it up! 82 | ENTRYPOINT ["linuxcnc-entrypoint.sh"] 83 | CMD ["start"] 84 | 85 | # Fin 86 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | platforms := linux/amd64 linux/i386 linux/arm32v7 linux/arm64v8 2 | 3 | os = $(word 1, $(subst /, ,$@)) 4 | arch = $(word 2, $(subst /, ,$@)) 5 | 6 | XSOCK := /tmp/.X11-unix/X0 7 | DISPLAY := :0 8 | 9 | version = v1.1.0 10 | 11 | # to run under WSL use: make DOCKER=/mnt/c/Progra~1/Docker/Docker/resources/bin/docker.exe 12 | DOCKER = $(shell which docker) 13 | BUILD_NUMBER_FILE = .BUILD_NUMBER 14 | 15 | .PHONY: build squash manifest push publish clean quick debug 16 | 17 | %/build: $(BUILD_NUMBER_FILE) 18 | $(DOCKER) build --build-arg PLATFORM=$(arch) \ 19 | -t jeffersonjhunt/linuxcnc:$(os)-$(arch)-$(version).$$(cat $(BUILD_NUMBER_FILE)) . 20 | 21 | %/squash: 22 | $(DOCKER) build --squash --build-arg PLATFORM=$(arch) \ 23 | -t jeffersonjhunt/linuxcnc:$(os)-$(arch)-$(version).$$(cat $(BUILD_NUMBER_FILE)) . 24 | 25 | %/manifest: 26 | $(DOCKER) manifest create --amend jeffersonjhunt/linuxcnc:latest \ 27 | jeffersonjhunt/linuxcnc:$(os)-$(arch)-$(version).$$(cat $(BUILD_NUMBER_FILE)) 28 | $(DOCKER) manifest create --amend jeffersonjhunt/linuxcnc:$(version) \ 29 | jeffersonjhunt/linuxcnc:$(os)-$(arch)-$(version).$$(cat $(BUILD_NUMBER_FILE)) 30 | 31 | %/push: 32 | $(DOCKER) login 33 | $(DOCKER) push jeffersonjhunt/linuxcnc:$(os)-$(arch)-$(version).$$(cat $(BUILD_NUMBER_FILE)) 34 | 35 | publish: manifest 36 | $(DOCKER) login 37 | $(DOCKER) manifest push --purge jeffersonjhunt/linuxcnc:$(version) 38 | $(DOCKER) manifest push --purge jeffersonjhunt/linuxcnc:latest 39 | 40 | %/clean: 41 | do$(DOCKER)cker rmi jeffersonjhunt/linuxcnc:$(os)-$(arch)-$(version).$$(cat $(BUILD_NUMBER_FILE)) 42 | 43 | clean: 44 | for p in $(platforms); do \ 45 | $(MAKE) $$p/clean; \ 46 | done 47 | 48 | %/run: 49 | xhost + 50 | docker run --rm -it -v $(XSOCK):$(XSOCK) \ 51 | -e DISPLAY=$(DISPLAY) \ 52 | jeffersonjhunt/linuxcnc:$(os)-$(arch)-$(version).$$(cat $(BUILD_NUMBER_FILE)) 53 | 54 | %/realtime: 55 | xhost + 56 | $(DOCKER) run --rm -it \ 57 | --oom-kill-disable --cpu-rt-runtime=950000 --ulimit rtprio=99 --cap-add=sys_nice \ 58 | -e DISPLAY=$(DISPLAY) \ 59 | -v $(XSOCK):$(XSOCK) jeffersonjhunt/linuxcnc:$(os)-$(arch)-$(version).$$(cat $(BUILD_NUMBER_FILE)) 60 | 61 | %/debug: 62 | $(DOCKER) run --rm -it --entrypoint /bin/bash \ 63 | jeffersonjhunt/linuxcnc:$(os)-$(arch)-$(version).$$(cat $(BUILD_NUMBER_FILE)) 64 | 65 | include tools.mak 66 | -------------------------------------------------------------------------------- /README.Docker.md: -------------------------------------------------------------------------------- 1 | # Supported tags and respective Dockerfile links 2 | 3 | * [latest](https://github.com/jeffersonjhunt/linuxcnc-docker/blob/master/Dockerfile "Dockerfile") 4 | * [v1.1.0](https://github.com/jeffersonjhunt/linuxcnc-docker/blob/v1.1.0/Dockerfile "Dockerfile") 5 | 6 | # Quick reference 7 | 8 | * __Where to file issues:__ 9 | 10 | https://github.com/jeffersonjhunt/linuxcnc-docker/issues 11 | 12 | * __Maintained by:__ 13 | 14 | [jeffersonjhunt](https://hub.docker.com/u/jeffersonjhunt "Profile of Jefferson J Hunt") 15 | 16 | * __Supported architectures: [(more info)](https://github.com/docker-library/official-images#architectures-other-than-amd64 "Docker alt architectures")__ 17 | 18 | amd64 (x86_64), i386, arm32v7 (armhf), arm64v8 19 | 20 | * __Supported Single Board Computers (SBC): [(more info)](https://github.com/jeffersonjhunt/linuxcnc-docker/blob/master/guides "Guides")__ 21 | 22 | Raspberry Pi 3 Model B, Raspberry Pi 3 Model B+, NVIDIA Jetson Nano 23 | 24 | * __Source of this description:__ 25 | 26 | On the GitHub repo at [README.Docker.md](https://github.com/jeffersonjhunt/linuxcnc-docker/blob/master/README.Docker.md "README.Docker.md") 27 | 28 | * __Supported Docker versions:__ 29 | 30 | the latest CE release (down to 17-ce on a best-effort basis) 31 | 32 | # What is LinuxCNC? 33 | 34 | *from the [LinuxCNC GitHub Repo](https://github.com/LinuxCNC/linuxcnc "GitHub LinuxCNC"):* 35 | 36 | >LinuxCNC controls CNC machines. It can drive milling machines, lathes, 3d printers, laser cutters, plasma cutters, robot arms, hexapods, and more. [LinuxCNC Homepage](http://linuxcnc.org/ "LinuxCNC Homepage") 37 | 38 | # How to use this image 39 | 40 | ### Run LinuxCNC 41 | ```bash 42 | $ xhost + 43 | $ docker run --rm -it -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -e DISPLAY=:0 jeffersonjhunt/linuxcnc start 44 | ``` 45 | 46 | This will run LinuxCNC without Realtime OS support and should only be used for testing. For Realtime OS support, see the 47 | [README.md](https://github.com/jeffersonjhunt/linuxcnc-docker/blob/master/README.md "README.md") 48 | 49 | # Building the Dockerfile 50 | 51 | For more information about the build, versions used and how to modify it see the 52 | [README.md](https://github.com/jeffersonjhunt/linuxcnc-docker/blob/master/README.md "README.md") 53 | 54 | # License 55 | View license information for the software contained in this image. 56 | 57 | As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained). 58 | 59 | As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within. 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Readme 2 | 3 | This document covers the current state of the Docker built image. It enumerates the known issues, todo lists, etc... 4 | 5 | ## Releases 6 | 7 | See [RELEASE.md](https://github.com/jeffersonjhunt/linuxcnc-docker/blob/master/RELEASE.md "RELEASE.md") for more details. 8 | 9 | * v1.1.0 - 10 | * [Dockerfile](https://github.com/jeffersonjhunt/linuxcnc-docker/blob/v1.1.0/Dockerfile "Dockerfile") 11 | * [Docker Image](https://hub.docker.com/r/jeffersonjhunt/linuxcnc "Docker Image") 12 | 13 | ## Basics 14 | 15 | See the [README.Docker.md](https://github.com/jeffersonjhunt/linuxcnc-docker/blob/master/README.Docker.md "README.Docker.md") for more information on basic operation using Docker. 16 | 17 | Single Board Computers (SBC) like the *Raspberry Pi* and *NVIDIA Jetson Nano* are supported via Docker with specific guides located [here](https://github.com/jeffersonjhunt/linuxcnc-docker/blob/master/guides "Guides"). 18 | 19 | ### Run 20 | 21 | ```bash 22 | $ xhost + 23 | $ docker run --rm -it -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -e DISPLAY=:0 jeffersonjhunt/linuxcnc start 24 | ``` 25 | 26 | ### Realtime OS Run 27 | 28 | ```bash 29 | $ xhost + 30 | $ docker run --rm -it --oom-kill-disable --cpu-rt-runtime=950000 --ulimit rtprio=99 --cap-add=sys_nice \ 31 | -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -e DISPLAY=:0 jeffersonjhunt/linuxcnc start 32 | ``` 33 | 34 | ## Config & Control 35 | 36 | ### Entrypoint script 37 | 38 | The `linuxcnc-entrypoint.sh` is used to simplify the interaction of Docker with LinuxCNC. Docker passes in any additional arguments to the run command to the entrypoint. 39 | 40 | ## Build Notes 41 | 42 | ### Dockerfile 43 | #### Structure 44 | 45 | The `Dockerfile` is broken into several __RUN__ sections to allow for quicker builds while adding and refining modules, plugins, supporting apps and new versions of LinuxCNC. 46 | 47 | #### Build 48 | 49 | See: `BUILD.md` for complete details on building, debugging and packaging. 50 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | ### TBD 2 | 3 | TODO: complete setup guides for SBCs 4 | TODO: create windows native docker image 5 | 6 | ### v1.1.0 (Fri 23 Aug 2019 01:39:06 PM CDT) 7 | 8 | * update debian to stable-20190812-slim 9 | * add build numbers (will not affect release versions) 10 | 11 | ### v1.0.0 (Tue 13 Aug 2019 10:17:00 AM CDT) 12 | 13 | * initial commit to GitHub 14 | * [GitHub](https://github.com/jeffersonjhunt/linuxcnc-docker "GitHub Repo") 15 | * initial commit of image to Docker Hub 16 | * [Docker Hub](https://cloud.docker.com/u/jeffersonjhunt/repository/docker/jeffersonjhunt/linuxcnc "Docker Image") 17 | -------------------------------------------------------------------------------- /guides/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeffersonjhunt/linuxcnc-docker/63d0a860a1e8a1216fede53deaa143942690d2c3/guides/README.md -------------------------------------------------------------------------------- /guides/nvidia-jetson.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeffersonjhunt/linuxcnc-docker/63d0a860a1e8a1216fede53deaa143942690d2c3/guides/nvidia-jetson.md -------------------------------------------------------------------------------- /guides/raspberry-pi.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeffersonjhunt/linuxcnc-docker/63d0a860a1e8a1216fede53deaa143942690d2c3/guides/raspberry-pi.md -------------------------------------------------------------------------------- /linuxcnc-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2019 Jefferson J. Hunt 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # echo to stderr instead of stdout 18 | function echoerr() { 19 | echo "$@" 1>&2; 20 | } 21 | 22 | # print out a message IF debug flag is set 23 | function debug() { 24 | if [[ "${__DEBUG}" -eq "1" ]]; then 25 | echo $@ 26 | fi 27 | } 28 | 29 | # stop linuxcnc 30 | function stop() { 31 | debug "stopping linuxcnc" 32 | killall linuxcnc 33 | } 34 | 35 | # start linuxcnc 36 | function start() { 37 | debug "starting linuxcnc" 38 | /opt/linuxcnc/scripts/linuxcnc 39 | } 40 | 41 | # print help 42 | function help() { 43 | cat << EOF 44 | 45 | usage: ${SOURCE} [options] command 46 | 47 | options: 48 | 49 | -d|--debug : Print addition details to help solve problems 50 | 51 | comands: 52 | 53 | start : start LinuxCNC 54 | 55 | stop : stop LinuxCNC 56 | 57 | example: 58 | 59 | linuxcnc-entrypoint.sh -d start 60 | 61 | docker-example: 62 | 63 | docker run --rm -it jeffersonjhunt/linuxcnc -d start 64 | 65 | See README.md for more details and examples 66 | 67 | EOF 68 | } 69 | 70 | # Bootstrap 71 | SOURCE="${BASH_SOURCE[0]}" 72 | SOURCE=$(echo ${SOURCE} | sed 's/\.\///') 73 | while [ -h "${SOURCE}" ]; do 74 | DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )" 75 | SOURCE="$(readlink "${SOURCE}")" 76 | [[ ${SOURCE} != /* ]] && SOURCE="${DIR}/${SOURCE}" 77 | done 78 | DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )" 79 | 80 | # Try and help out a clueless user 81 | case "$1" in 82 | help|-h|--help) help; exit;; 83 | *);; 84 | esac 85 | 86 | if [[ $# -eq 0 ]]; then 87 | help; exit 88 | fi 89 | 90 | # Process CLI Arugments 91 | while [[ $# -gt 0 ]]; do 92 | key="$1" 93 | case "$key" in 94 | # use debug 95 | -d|--debug) 96 | __DEBUG=1 97 | ;; 98 | # Commands 99 | start) 100 | shift 101 | start $@ 102 | exit 103 | ;; 104 | stop) 105 | shift 106 | stop $@ 107 | exit 108 | ;; 109 | # Interactive shell for container testing 110 | bash) 111 | shift 112 | bash -i 113 | exit 114 | ;; 115 | *) 116 | # wtf options 117 | echoerr "Unknown option '$key'" 118 | ;; 119 | esac 120 | # Shift after checking all the cases to get the next option 121 | shift 122 | done 123 | 124 | echoerr "no command" 125 | help 126 | exit 255 127 | 128 | # fin -------------------------------------------------------------------------------- /tools.mak: -------------------------------------------------------------------------------- 1 | # Create an auto-incrementing build number. 2 | 3 | BUILD_NUMBER_LDFLAGS = -Xlinker --defsym -Xlinker __BUILD_DATE=$$(date +'%Y%m%d') 4 | BUILD_NUMBER_LDFLAGS += -Xlinker --defsym -Xlinker __BUILD_NUMBER=$$(cat $(BUILD_NUMBER_FILE)) 5 | 6 | # Build number file. Increment if any object file changes. 7 | $(BUILD_NUMBER_FILE): $(OBJECTS) 8 | @if ! test -f $(BUILD_NUMBER_FILE); then echo 999 > $(BUILD_NUMBER_FILE); fi 9 | @echo $$(($$(cat $(BUILD_NUMBER_FILE)) + 1)) > $(BUILD_NUMBER_FILE) 10 | 11 | # Common build commands 12 | 13 | .PHONY: build squash manifest push quick debug tag 14 | 15 | build: 16 | for p in $(platforms); do \ 17 | $(MAKE) $$p/build; \ 18 | done 19 | 20 | squash: 21 | for p in $(platforms); do \ 22 | $(MAKE) $$p/squash; \ 23 | done 24 | 25 | manifest: push 26 | for p in $(platforms); do \ 27 | $(MAKE) $$p/manifest; \ 28 | done 29 | 30 | push: squash tag 31 | for p in $(platforms); do \ 32 | $(MAKE) $$p/push; \ 33 | done 34 | 35 | git push origin $(version).$$(cat $(BUILD_NUMBER_FILE)) 36 | 37 | tag: 38 | git tag -a $(version).$$(cat $(BUILD_NUMBER_FILE)) -m "release $(version) build $$(cat $(BUILD_NUMBER_FILE))" 39 | 40 | quick: linux/amd64/build linux/amd64/run 41 | 42 | debug: linux/amd64/debug 43 | 44 | --------------------------------------------------------------------------------