Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
torchiaf committed Jan 3, 2025
1 parent 43475eb commit 3ae05b6
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/actions/docker-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inputs:
file:
description: ""
required: true
working-directory:
context:
description: ""
required: true
build-args:
Expand Down Expand Up @@ -49,13 +49,13 @@ runs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
working-directory: ${{ inputs.working-directory }}
working-directory: ${{ inputs.context }}

- name: Build and push
uses: docker/build-push-action@v6
with:
file: ${{ inputs.file }}
context: ${{ inputs.working-directory }}
context: ${{ inputs.context }}
build-args: ${{ inputs.build-args }}
platforms: ${{ inputs.platforms }}
provenance: false
Expand Down
37 changes: 21 additions & 16 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
image-name: controller
tag-name: ${{ github.ref_name }}
working-directory: controller
context: controller
file: controller/Dockerfile
platforms: ''

Expand All @@ -53,18 +53,18 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Build and Publish Docker image
id: devices
uses: ./.github/actions/docker-push
with:
registry: ${{ env.REGISTRY }}
repository_lc: ${{ env.REPO_LC }}
token: ${{ secrets.GITHUB_TOKEN }}
image-name: device/${{ matrix.device }}
tag-name: ${{ github.ref_name }}-${{ matrix.module }}
working-directory: modules/${{ matrix.module }}/devices/${{ matrix.device }}
file: modules/${{ matrix.module }}/devices/${{ matrix.device }}/Dockerfile
platforms: linux/arm64
# - name: Run Build and Publish Docker image
# id: devices
# uses: ./.github/actions/docker-push
# with:
# registry: ${{ env.REGISTRY }}
# repository_lc: ${{ env.REPO_LC }}
# token: ${{ secrets.GITHUB_TOKEN }}
# image-name: device/${{ matrix.device }}
# tag-name: ${{ github.ref_name }}-${{ matrix.module }}
# context: modules/${{ matrix.module }}/devices/${{ matrix.device }}
# file: modules/${{ matrix.module }}/devices/${{ matrix.device }}/Dockerfile
# platforms: linux/arm64

build-and-push-modules:
runs-on: ubuntu-latest
Expand All @@ -87,7 +87,12 @@ jobs:
- name: Generate Module Dockerfile
id: generate_dockerfile
shell: sh
run: sh ./scripts/generate-module-dockerfile.sh ${{ matrix.module }} ${{ steps.devices_list.outputs.devices }} ${{ env.REGISTRY }} ${{ github.repository_owner }} ${{ env.REPO_LC }} ${{ github.ref_name }}
run: sh ./scripts/generate-module-dockerfile.sh ${{ matrix.module }} ${{ steps.devices_list.outputs.devices }} ${{ env.REGISTRY }} ${{ github.repository_owner }} ${{ env.REPO_LC }} ${{ github.ref_name }} modules/${{ matrix.module }}/Dockerfile

- name: Print
shell: sh
run: cat modules/${{ matrix.module }}/Dockerfile

- name: Run Build and Publish Docker image
id: modules
uses: ./.github/actions/docker-push
Expand All @@ -97,6 +102,6 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
image-name: module/${{ matrix.module }}
tag-name: ${{ github.ref_name }}
working-directory: modules
file: ./Dockerfile
context: modules
file: modules/${{ matrix.module }}/Dockerfile
platforms: linux/arm64
File renamed without changes.
File renamed without changes.
18 changes: 10 additions & 8 deletions scripts/generate-module-dockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ GITHUB_REPOSITORY_OWNER=$4
GITHUB_REPO=$5
GITHUB_REF_NAME=$6

echo "# Module: $MODULE, Devices: $2" > Dockerfile
OUTPUT=$7

echo "# Module: $MODULE, Devices: $2" > $OUTPUT

for device in $DEVICES; do
echo "FROM $GITHUB_REGISTRY/$GITHUB_REPOSITORY_OWNER/$GITHUB_REPO/device/$device:$GITHUB_REF_NAME-$MODULE AS $device" >> Dockerfile
echo "FROM $GITHUB_REGISTRY/$GITHUB_REPOSITORY_OWNER/$GITHUB_REPO/device/$device:$GITHUB_REF_NAME-$MODULE AS $device" >> $OUTPUT
done
echo "" >> Dockerfile
echo "" >> $OUTPUT

echo "# Module: $MODULE build" >> Dockerfile
cat modules/$MODULE/Dockerfile >> Dockerfile
echo "# Module: $MODULE build" >> $OUTPUT
cat modules/$MODULE/build_template >> $OUTPUT

for device in $DEVICES; do
echo "COPY --from=$device /dist/$device /rpc_server" >> Dockerfile
echo "COPY --from=$device /dist/$device /rpc_server" >> $OUTPUT
done
echo "" >> Dockerfile
echo "" >> $OUTPUT

echo "CMD [\"./init\"]" >> Dockerfile
echo "CMD [\"./init\"]" >> $OUTPUT

0 comments on commit 3ae05b6

Please sign in to comment.