Skip to content

Commit 7ffbfd7

Browse files
authored
Split docker image build into kicad nightly and kicad-render and change 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
1 parent a858061 commit 7ffbfd7

File tree

5 files changed

+77
-17
lines changed

5 files changed

+77
-17
lines changed

.github/workflows/image.yaml

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
name: build docker image
1+
name: build kicad-render image
22
on:
33
push:
4+
paths:
5+
- Dockerfile
6+
- '*.sh'
7+
- .github/workflows/image.yaml
8+
49
jobs:
510
push_to_registry:
611
name: Push Docker image to Docker Hub
@@ -21,12 +26,27 @@ jobs:
2126
username: ${{ github.actor }}
2227
password: ${{ secrets.GITHUB_TOKEN }}
2328

29+
- name: Get current date
30+
id: date
31+
run: echo "date=$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_OUTPUT
32+
- name: Build and push Docker image dev
33+
if: github.ref_name == 'dev'
34+
uses: docker/build-push-action@v5
35+
with:
36+
context: .
37+
file: ./Dockerfile
38+
push: true
39+
build-args: |
40+
"VERSION=${{ github.sha }}-dev"
41+
tags: "ghcr.io/linalinn/kicad-render:dev,ghcr.io/linalinn/kicad-render:dev-${{ steps.date.outputs.date }}"
42+
2443
- name: Build and push Docker image
44+
if: github.ref_name == github.event.repository.default_branch
2545
uses: docker/build-push-action@v5
2646
with:
2747
context: .
2848
file: ./Dockerfile
2949
push: true
3050
build-args: |
3151
"VERSION=${{ github.sha }}"
32-
tags: ghcr.io/linalinn/kicad-render:nightly
52+
tags: ghcr.io/linalinn/kicad-render:nightly,ghcr.io/linalinn/kicad-render:nightly-${{ steps.date.outputs.date }}

.github/workflows/kicad-nightly.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: kicad nightly base
2+
on:
3+
workflow_dispatch:
4+
push:
5+
paths:
6+
- Dockerfile.kicad-nightly
7+
- .github/workflows/kicad-nightly.yaml
8+
jobs:
9+
push_to_registry:
10+
name: Push Docker image to Docker Hub
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
packages: write
15+
contents: read
16+
steps:
17+
- name: Check out the repo
18+
uses: actions/checkout@v4
19+
20+
- name: Login to GitHub Container Registry
21+
uses: docker/login-action@v3
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Get current date
28+
id: date
29+
run: echo "date=$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_OUTPUT
30+
31+
- name: Build and push Docker image dev
32+
uses: docker/build-push-action@v5
33+
with:
34+
context: .
35+
file: ./Dockerfile
36+
push: true
37+
build-args: |
38+
"VERSION=${{ github.sha }}-dev"
39+
tags: "ghcr.io/linalinn/kicad:nightly,ghcr.io/linalinn/kicad:nightly-${{ steps.date.outputs.date }}"

Dockerfile

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
1-
FROM ubuntu:22.04
2-
3-
ARG DEBIAN_FRONTEND=noninteractive
4-
5-
ARG VERSION=no-version
6-
7-
ENV VERSION=$VERSION
8-
9-
RUN apt-get update -y && \
10-
apt-get install -y software-properties-common && \
11-
add-apt-repository -y ppa:kicad/kicad-dev-nightly && \
12-
apt-get install kicad-nightly ffmpeg -y && \
13-
rm -rf /var/lib/apt/lists/*
1+
FROM ghcr.io/linalinn/kicad:nightly-2024-04-09-13-16
142

153
COPY *.sh /usr/bin/
164

Dockerfile.kicad-nightly

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ubuntu:22.04
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
5+
ARG VERSION=no-version
6+
7+
ENV VERSION=$VERSION
8+
9+
RUN apt-get update -y && \
10+
apt-get install -y software-properties-common && \
11+
add-apt-repository -y ppa:kicad/kicad-dev-nightly && \
12+
apt-get install kicad-nightly ffmpeg -y && \
13+
rm -rf /var/lib/apt/lists/*

kicad_animation.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ OUTPUT_DIR="${3:-/pwd}"
2929
FRAME_DIR="/tmp/render"
3030
INPUT_FILE="$2"
3131
ZOOM=0.7
32-
WIDTH=1080
33-
HEIGHT=1080
32+
WIDTH=300
33+
HEIGHT=300
3434
ROTATE_X=0
3535
ROTATE_Z=45
3636
ROTATION=360 # Total rotation angle

0 commit comments

Comments
 (0)