-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from vkhurana/github-action
github actions
- Loading branch information
Showing
3 changed files
with
125 additions
and
0 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,50 @@ | ||
name: 'Build and Publish Docker Image' | ||
|
||
on: | ||
push: | ||
branches: [main, develop] | ||
paths-ignore: [README.md] | ||
pull_request: | ||
branches: [main] | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 2 * * MON" | ||
|
||
jobs: | ||
build: | ||
name: 'Build and Publish Docker Image' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
# https://github.com/marketplace/actions/checkout | ||
- name: 'Checkout Code' | ||
uses: actions/checkout@v4 | ||
|
||
# https://github.com/marketplace/actions/docker-setup-qemu | ||
- name: 'Setup QEMU' | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: linux/amd64 #,linux/arm64,linux/arm/v7 | ||
|
||
# https://github.com/marketplace/actions/docker-setup-buildx | ||
- name: 'Setup Docker Buildx' | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# https://github.com/marketplace/actions/docker-login | ||
- name: 'Login to Docker Hub' | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
# https://github.com/marketplace/actions/build-and-push-docker-images | ||
- name: 'Build and Push docker-prusaslicer' | ||
uses: docker/build-push-action@v5 | ||
with: | ||
platforms: linux/amd64 | ||
push: ${{ (github.event_name != 'pull_request') }} #don't push for pull requests | ||
tags: | | ||
vkhurana/docker-prusaslicer:${{ endsWith(github.ref, 'refs/heads/main') && 'latest' || 'develop' }} | ||
build-args: | | ||
LABEL_VERSION=python3 |
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,27 @@ | ||
name: 'Update Docker Hub Description' | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- README.md | ||
- .github/workflows/update-dockerhub-description.yml | ||
jobs: | ||
description: | ||
name: 'Update Docker Hub Description' | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
# https://github.com/marketplace/actions/checkout | ||
- name: 'Checkout Code' | ||
uses: actions/checkout@v4 | ||
|
||
# https://github.com/marketplace/actions/docker-hub-description | ||
# Access tokens cannot update readme.md, we have to use the real password | ||
- name: 'Update Docker Hub Description' | ||
uses: peter-evans/dockerhub-description@v4 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
repository: vkhurana/docker-prusaslicer | ||
|
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,48 @@ | ||
# Docker Prusaslicer | ||
|
||
Monitors a folder for .stl files and uses Prusa Slicer to create .gcode files to send to the printer. | ||
|
||
This is a docker image on Ubuntu with Python and Prusa Slicer, and uses `watchdog` to monitor the directory. | ||
|
||
## Usage | ||
1. The container exposes two mount points `/configs/` and `/prints/`. Use `/configs` to place `.ini` files exported from Prusa Slicer GUI. The container will monitor `/prints` as the folder for inputs (and generating .gcode files from the .stls) | ||
2. In the `/prints` folder create a subfolder with the `.stl` files you want to slice (ex: `/prints/project1/`) | ||
3. To get the slicer to merge all the `.stl` files and create a `.gcode`: create a empty file with the name of the config you want to use (from the `/configs/` folder) and ending in `/slice` (ex: `touch /prints/project1/pla-supports.slice`) | ||
4. A new `.gcode` file is created based on the config specified and can be sent to the printer | ||
|
||
## License | ||
|
||
![GitHub License](https://img.shields.io/github/license/vkhurana/docker-prusaslicer) | ||
|
||
## Build Status | ||
|
||
[Code and Pipline is on GitHub](https://github.com/vkhurana/docker-prusaslicer): | ||
![GitHub Last Commit](https://img.shields.io/github/last-commit/vkhurana/docker-prusaslicer?logo=github) | ||
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vkhurana/docker-prusaslicer/.github/workflows/BuildPublishPipeline.yml?logo=github) | ||
## Container Images | ||
|
||
Docker container images are published on [Docker Hub](https://hub.docker.com/r/vkhurana/docker-prusaslicer). | ||
Images are tagged using `latest` | ||
|
||
![Docker Pulls](https://img.shields.io/docker/pulls/vkhurana/docker-prusaslicer?logo=docker) | ||
![Docker Image Version](https://img.shields.io/docker/v/vkhurana/docker-prusaslicer/latest?logo=docker) | ||
|
||
## Docker Commands | ||
Sample usage with ephemeral container: | ||
Interactive: | ||
`docker run --name="docker-slicer-inst" -v /home/vivek/code/tmp/slicer-tst/configs/:/configs -v /home/vivek/code/tmp/slicer-tst/prints/:/prints -it --rm docker-slicer` | ||
|
||
Detached: | ||
`docker run --name="docker-slicer-inst" -v /home/vivek/code/tmp/slicer-tst/configs/:/configs -v /home/vivek/code/tmp/slicer-tst/prints/:/prints -d --rm docker-slicer` | ||
|
||
## Docker Build | ||
`docker build -t docker-slicer .` | ||
|
||
## Background Info | ||
|
||
This is a stateless container. | ||
|
||
## Notes | ||
|
||
- Runs on `Python 3` | ||
- Pulls `Pusa Slicer` from Github and `OpenScad` from APT |