Skip to content

Commit d9aa080

Browse files
committed
Add rm-docker-linux package that pre-builds linux
1 parent 2ad110e commit d9aa080

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

.github/workflows/docker-image.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Docker Image CI
22

33
on:
44
push:
5-
branches: [ "main", "dev" ]
65
pull_request:
76
branches: [ "main" ]
87

@@ -11,8 +10,40 @@ env:
1110
IMAGE_NAME: ${{ github.repository }}
1211

1312
jobs:
13+
build-linux:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
steps:
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Login to GitHub Container Registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Docker meta
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-linux
34+
35+
- name: Build
36+
uses: docker/build-push-action@v5
37+
with:
38+
push: ${{ github.event_name != 'pull_request' }}
39+
tags: ${{ steps.meta.outputs.tags }}
40+
target: linux-build
41+
cache-from: type=gha
42+
cache-to: type=gha,mode=max
43+
1444
build:
1545
runs-on: ubuntu-latest
46+
needs: [build-linux]
1647
permissions:
1748
contents: read
1849
packages: write

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ARG toltec_image=ghcr.io/toltec-dev/base:v3.1
33
ARG rm2_stuff_tag=v0.1.2
44
ARG fw_version=3.5.2.1807
55
ARG linux_release=5.8.18
6+
ARG linux_image=ghcr.io/timower/rm-docker-linux:latest
67

78
# Step 1: Build Linux for the emulator
89
FROM $toltec_image as linux-build
@@ -33,6 +34,9 @@ RUN make O=imx7 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j $(nproc) && \
3334
cp imx7/arch/arm/boot/dts/imx7d-rm.dtb /opt && \
3435
rm -rf imx7
3536

37+
# Dummy stage to use in the arg below
38+
FROM $linux_image AS linux-image
39+
3640
# Step 2: rootfs
3741
FROM linuxkit/guestfs:f85d370f7a3b0749063213c2dd451020e3a631ab AS rootfs
3842

@@ -69,8 +73,8 @@ RUN apt-get update && \
6973

7074
RUN mkdir -p /opt/root
7175

72-
COPY --from=linux-build /opt/zImage /opt
73-
COPY --from=linux-build /opt/imx7d-rm.dtb /opt
76+
COPY --from=linux-image /opt/zImage /opt
77+
COPY --from=linux-image /opt/imx7d-rm.dtb /opt
7478
COPY --from=rootfs /opt/rootfs.qcow2 /opt/root
7579

7680
ADD bin /opt/bin

0 commit comments

Comments
 (0)