Skip to content

Commit

Permalink
Add embedded-gateway-builder docker
Browse files Browse the repository at this point in the history
  • Loading branch information
sgliner-wirepas committed Dec 2, 2024
1 parent 0944510 commit ac50348
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -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: "ghcr.io/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 }}
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Binary file added libicu55_55.1-7ubuntu0.5_amd64.deb
Binary file not shown.

0 comments on commit ac50348

Please sign in to comment.