Skip to content

Commit

Permalink
Split docker image build into kicad nightly and kicad-render and chan…
Browse files Browse the repository at this point in the history
…ge animation scale (#2)

* reduce size to 300px for usage in readme.md

* publish to tag dev on branch dev

* add time and date to extra tag

* Used echo >> $GITHUB_STATE

* fix state

* Add kicad-nightly image for faster kicad-render builds

* build kicad nightly on workflow change

* only build kicad-render on change to script or dockerfile

* Use pre build  kicad image to speed up build of kicad-render

* fix tag
  • Loading branch information
linalinn authored Apr 9, 2024
1 parent a858061 commit 7ffbfd7
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 17 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: build docker image
name: build kicad-render image
on:
push:
paths:
- Dockerfile
- '*.sh'
- .github/workflows/image.yaml

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
Expand All @@ -21,12 +26,27 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_OUTPUT
- name: Build and push Docker image dev
if: github.ref_name == 'dev'
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
build-args: |
"VERSION=${{ github.sha }}-dev"
tags: "ghcr.io/linalinn/kicad-render:dev,ghcr.io/linalinn/kicad-render:dev-${{ steps.date.outputs.date }}"

- name: Build and push Docker image
if: github.ref_name == github.event.repository.default_branch
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
build-args: |
"VERSION=${{ github.sha }}"
tags: ghcr.io/linalinn/kicad-render:nightly
tags: ghcr.io/linalinn/kicad-render:nightly,ghcr.io/linalinn/kicad-render:nightly-${{ steps.date.outputs.date }}
39 changes: 39 additions & 0 deletions .github/workflows/kicad-nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: kicad nightly base
on:
workflow_dispatch:
push:
paths:
- Dockerfile.kicad-nightly
- .github/workflows/kicad-nightly.yaml
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest

permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_OUTPUT

- name: Build and push Docker image dev
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
build-args: |
"VERSION=${{ github.sha }}-dev"
tags: "ghcr.io/linalinn/kicad:nightly,ghcr.io/linalinn/kicad:nightly-${{ steps.date.outputs.date }}"
14 changes: 1 addition & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

ARG VERSION=no-version

ENV VERSION=$VERSION

RUN apt-get update -y && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:kicad/kicad-dev-nightly && \
apt-get install kicad-nightly ffmpeg -y && \
rm -rf /var/lib/apt/lists/*
FROM ghcr.io/linalinn/kicad:nightly-2024-04-09-13-16

COPY *.sh /usr/bin/

Expand Down
13 changes: 13 additions & 0 deletions Dockerfile.kicad-nightly
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

ARG VERSION=no-version

ENV VERSION=$VERSION

RUN apt-get update -y && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:kicad/kicad-dev-nightly && \
apt-get install kicad-nightly ffmpeg -y && \
rm -rf /var/lib/apt/lists/*
4 changes: 2 additions & 2 deletions kicad_animation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ OUTPUT_DIR="${3:-/pwd}"
FRAME_DIR="/tmp/render"
INPUT_FILE="$2"
ZOOM=0.7
WIDTH=1080
HEIGHT=1080
WIDTH=300
HEIGHT=300
ROTATE_X=0
ROTATE_Z=45
ROTATION=360 # Total rotation angle
Expand Down

0 comments on commit 7ffbfd7

Please sign in to comment.