Skip to content

Commit e24831a

Browse files
Add embedded-gateway-builder docker
1 parent 0944510 commit e24831a

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed

.github/workflows/build-docker.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Embedded Gateway Builder
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Tag to push on Docker Hub'
8+
required: true
9+
push_image:
10+
description: 'Push Docker image'
11+
required: false
12+
type: boolean
13+
default: false
14+
push:
15+
branches:
16+
- main
17+
paths:
18+
- .github/workflows/build-docker.yml
19+
- Dockerfile
20+
tags:
21+
- 'v*'
22+
23+
jobs:
24+
build:
25+
name: Build and push embedded-gateway-builder image
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: read
29+
packages: write
30+
31+
steps:
32+
- name: Clone
33+
uses: actions/checkout@v4
34+
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v2
37+
38+
- name: Log in to the Container registry
39+
uses: docker/login-action@v3
40+
with:
41+
registry: ghcr.io
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Set tags based on event
46+
env:
47+
IMAGE_NAME: "ghcr.io/wirepas/embedded-gateway-builder"
48+
run: |
49+
# For a push triggered event, use the edge tag and push
50+
if [[ "${{ github.event_name }}" == "push" ]]; then
51+
echo "TAG=${IMAGE_NAME}:edge" >> $GITHUB_ENV
52+
echo "PUSH_IMAGE=true" >> $GITHUB_ENV
53+
54+
# For a manually triggered event, use the provided input prefixed by "manual_" for the tag and push if needed
55+
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
56+
echo "TAG=${IMAGE_NAME}:manual_${{ github.event.inputs.tag }}" >> $GITHUB_ENV
57+
echo "PUSH_IMAGE=${{ github.event.inputs.push_image || 'false' }}" >> $GITHUB_ENV
58+
59+
# For a tag triggered event, use the version for the tag and push
60+
elif [[ "${{ github.event_name }}" == "tag" ]]; then
61+
echo "TAG=${IMAGE_NAME}:${{ github.ref_name }}" >> $GITHUB_ENV
62+
echo "PUSH_IMAGE=true" >> $GITHUB_ENV
63+
fi
64+
65+
- name: Build and push embedded-gateway-builder to GitHub Packages
66+
uses: docker/build-push-action@v6
67+
with:
68+
push: ${{ env.PUSH_IMAGE }}
69+
tags: ${{ env.TAG }}

Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
FROM ubuntu:24.04
2+
# Use the 20.04 LTS release instead of latest to have stable environement
3+
4+
# Create a default Wirepas user
5+
ARG user=wirepas
6+
RUN useradd -ms /bin/bash ${user}
7+
8+
# Install python3, pip and wget
9+
RUN apt-get update \
10+
&& apt-get install -y \
11+
bzip2 \
12+
cmake \
13+
curl \
14+
libglib2.0-0 \
15+
ninja-build \
16+
python3 \
17+
git \
18+
&& rm -fr /var/libapt/lists/*
19+
20+
WORKDIR /home/${user}
21+
22+
COPY libicu55_55.1-7ubuntu0.5_amd64.deb libicu55_55.1-7ubuntu0.5_amd64.deb
23+
RUN apt install ./libicu55_55.1-7ubuntu0.5_amd64.deb && rm ./libicu55_55.1-7ubuntu0.5_amd64.deb
24+
25+
# Install Arm compiler
26+
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" \
27+
&& tar xjf gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2 -C /opt/ \
28+
&& rm -f gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2
29+
30+
# Add Gcc 7 compiler to default path
31+
ENV PATH="/opt/gcc-arm-none-eabi-7-2017-q4-major/bin:${PATH}"
32+
33+
RUN apt-get update \
34+
&& apt-get install -y \
35+
libglib2.0-0 \
36+
&& rm -fr /var/libapt/lists/*
37+
38+
# No need to be root anymore
39+
USER ${user}
40+
41+
# Default to bash console
42+
CMD ["/bin/bash"]

libicu55_55.1-7ubuntu0.5_amd64.deb

7.3 MB
Binary file not shown.

0 commit comments

Comments
 (0)