Created
September 30, 2021 03:15
-
-
Save sidwarkd/9e591f633e456ab758bbb1a8325b6344 to your computer and use it in GitHub Desktop.
Github Actions Example of Mult-Arch Docker Image Build for ESP32 Firmware Flashing
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
name: create-programming-image | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
jobs: | |
build_firmware_assets: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Build binary assets | |
uses: docker://espressif/idf:v4.3.1 | |
with: | |
args: idf.py build | |
- name: Create asset artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: release-binaries | |
path: | | |
build/bootloader/bootloader.bin | |
build/partition_table/partition-table.bin | |
build/ota_data_initial.bin | |
build/statfeedr_firmware.bin | |
build/storage.bin | |
version.txt | |
if-no-files-found: error | |
retention-days: 1 | |
build_and_push_docker_images: | |
needs: build_firmware_assets | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Get firmware binary assets | |
uses: actions/download-artifact@v2 | |
with: | |
name: release-binaries | |
path: docker/binaries | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-west-2 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build, tag, and push image to Amazon ECR | |
id: build-image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: statfeedr_device_programming | |
IMAGE_TAG: ${{ github.event.release.tag_name || 'latest' }} | |
run: | | |
cd docker | |
docker buildx build --push --platform=linux/arm/v7,linux/amd64 -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | |
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" |
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
FROM debian:buster-slim | |
RUN apt update \ | |
&& apt install -y build-essential gcc make libftdi-dev git\ | |
&& git clone https://github.com/makercrew/ftx-prog.git /ftxprog \ | |
&& cd /ftxprog \ | |
&& make | |
FROM debian:buster-slim | |
COPY --from=0 /ftxprog/ftx_prog /ftxprog/ | |
RUN apt update \ | |
&& apt install -y python3 python3-pip libftdi-dev \ | |
&& pip3 install esptool | |
ADD *.sh tools/ | |
ADD binaries release/ | |
WORKDIR /tools |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment