diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 0000000..f636597 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,69 @@ +name: Embedded Gateway Builder + +on: + workflow_dispatch: + inputs: + tag: + description: 'Tag to push on Docker Hub' + required: true + push_image: + description: 'Push Docker image' + required: false + default: false + push: + branches: + - main + - work/image-builder + paths: + - .github/workflows/build-docker.yml + - Dockerfile + tags: + - 'v*' + +jobs: + build: + name: Build and push embedded-gateway-builder image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Clone + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set tags based on event + env: + IMAGE_NAME: wirepas/embedded-gateway-builder + run: | + # For a push triggered event, use the edge tag and push + if [[ "${{ github.event_name }}" == "push" ]]; then + echo "TAG=${IMAGE_NAME}:edge" >> $GITHUB_ENV + echo "PUSH_IMAGE=true" >> $GITHUB_ENV + + # For a manually triggered event, use the provided input prefixed by "manual_" for the tag and push if needed + elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "TAG=${IMAGE_NAME}:manual_${{ github.event.inputs.tag }}" >> $GITHUB_ENV + echo "PUSH_IMAGE=${{ github.event.inputs.push_image || 'false' }}" >> $GITHUB_ENV + + # For a tag triggered event, use the version for the tag and push + elif [[ "${{ github.event_name }}" == "tag" ]]; then + echo "TAG=${IMAGE_NAME}:${{ github.ref_name }}" >> $GITHUB_ENV + echo "PUSH_IMAGE=true" >> $GITHUB_ENV + fi + + - name: Build and push embedded-gateway-builder to GitHub Packages + uses: docker/build-push-action@v6 + with: + push: ${{ env.PUSH_IMAGE }} + tags: ${{ env.TAG }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7208804 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +FROM ubuntu:24.04 +# Use the 20.04 LTS release instead of latest to have stable environement + +# Create a default Wirepas user +ARG user=wirepas +RUN useradd -ms /bin/bash ${user} + +# Install python3, pip and wget +RUN apt-get update \ + && apt-get install -y \ + bzip2 \ + cmake \ + curl \ + libglib2.0-0 \ + ninja-build \ + python3 \ + git \ + && rm -fr /var/libapt/lists/* + +WORKDIR /home/${user} + +COPY libicu55_55.1-7ubuntu0.5_amd64.deb libicu55_55.1-7ubuntu0.5_amd64.deb +RUN apt install ./libicu55_55.1-7ubuntu0.5_amd64.deb && rm ./libicu55_55.1-7ubuntu0.5_amd64.deb + +# Install Arm compiler +RUN curl -Lso gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2 "https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/7-2017q4/gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2" \ + && tar xjf gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2 -C /opt/ \ + && rm -f gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2 + +# Add Gcc 7 compiler to default path +ENV PATH="/opt/gcc-arm-none-eabi-7-2017-q4-major/bin:${PATH}" + +RUN apt-get update \ + && apt-get install -y \ + libglib2.0-0 \ + && rm -fr /var/libapt/lists/* + +# No need to be root anymore +USER ${user} + +# Default to bash console +CMD ["/bin/bash"] diff --git a/libicu55_55.1-7ubuntu0.5_amd64.deb b/libicu55_55.1-7ubuntu0.5_amd64.deb new file mode 100755 index 0000000..032bae1 Binary files /dev/null and b/libicu55_55.1-7ubuntu0.5_amd64.deb differ