Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3e8fbe7

Browse files
committedJun 4, 2021
refactor: add build-container workflow
1 parent 1790422 commit 3e8fbe7

File tree

5 files changed

+46
-87
lines changed

5 files changed

+46
-87
lines changed
 

‎.devcontainer/Dockerfile

+7-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ENV PATH=${TOOLCHAIN_PATH}:${PATH}
2020

2121
RUN mkdir -p "${STAGING_DIR}"
2222

23-
RUN sudo apt-get update -y && apt-get install -y build-essential cmake3
23+
RUN sudo apt-get update -y && apt-get install -y build-essential cmake libtool
2424

2525
# install libzmq
2626
RUN git clone https://github.com/zeromq/libzmq.git /tmp/libzmq && cd /tmp/libzmq && git checkout 92282785ed8e3a954d379a0ac0e784dc29d94746
@@ -59,7 +59,7 @@ RUN DESTDIR=${STAGING_DIR} make -j4 install
5959
RUN git clone https://github.com/msgpack/msgpack-c.git /tmp/msgpack-c
6060

6161
# install dependencies for msgpack: doxygen and boost
62-
RUN sudo apt-get install doxygen
62+
RUN sudo apt-get install -y doxygen
6363
RUN git clone https://github.com/boostorg/boost.git /tmp/boost && cd /tmp/boost && git checkout eeb338c73f90028145c52ec9de07b6eb2b2ad4e8
6464
WORKDIR /tmp/boost
6565

@@ -76,7 +76,7 @@ RUN sed -i "/using gcc/c\using gcc : arm : $TOOLCHAIN-g++ ;" project-config.jam
7676
RUN ./b2 -toolset=$TOOLCHAIN address-model=32 architecture=arm --prefix=$STAGING_DIR/usr/local link=static install
7777

7878
# install gtest
79-
RUN apt-get install libgtest-dev
79+
RUN apt-get install -y libgtest-dev
8080
WORKDIR /usr/src/gtest
8181
RUN DESTDIR=$STAGING_DIR cmake CMakeLists.txt
8282
RUN make
@@ -113,7 +113,8 @@ WORKDIR /tmp/libusb
113113
# note: we need to create a symlink with the lib name and .so suffix (unversioned) only - otherwise linker won't find it
114114
RUN ln -s $STAGING_DIR/usr/lib/libudev.so.1 $STAGING_DIR/usr/lib/libudev.so
115115
RUN NOCONFIGURE=1 ./autogen.sh
116-
RUN C=$TOOLCHAIN-gcc ./configure --host=$TOOLCHAIN --enable-udev=yes --enable-shared CFLAGS="--sysroot=/opt/crosstool-ng/x-tools/arm-rpi-linux-gnueabihf/arm-rpi-linux-gnueabihf/sysroot -I$STAGING_DIR/usr/include" LDFLAGS="-L$STAGING_DIR/usr/lib"
116+
RUN which $TOOLCHAIN-gcc
117+
RUN C=$TOOLCHAIN-gcc ./configure --host=$TOOLCHAIN --enable-udev=yes --enable-shared CFLAGS="--sysroot=/opt/crosstool-ng/x-tools/$TOOLCHAIN/$TOOLCHAIN/sysroot -I$STAGING_DIR/usr/include" LDFLAGS="-L$STAGING_DIR/usr/lib"
117118
RUN LDFLAGS="-L$STAGING_DIR/usr/lib" make
118119
RUN make install DESTDIR=${STAGING_DIR}
119120

@@ -124,5 +125,5 @@ RUN apt-get install -y dh-make
124125
RUN apt-get install -y zip
125126

126127
# install aws-greengrass-sdk
127-
COPY ./rpi-scripts/install-aws-greengrass-sdk.sh ./install-aws-greengrass-sdk.sh
128-
RUN ./install-aws-greengrass-sdk.sh "${STAGING_DIR}" "-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE" "-DCMAKE_FIND_ROOT_PATH=$STAGING_DIR"
128+
RUN git clone https://github.com/aws/aws-greengrass-core-sdk-c.git /tmp/aws-sdk
129+
RUN cd /tmp/aws-sdk/ && git checkout a71613711438b48588e177f86ab322dd3992e780 && cd ./aws-greengrass-core-sdk-c && mkdir -p build && cd build && cmake "-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE" "-DCMAKE_FIND_ROOT_PATH=$STAGING_DIR" .. && cmake "-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE" "-DCMAKE_FIND_ROOT_PATH=$STAGING_DIR" --build . && sudo make install DESTDIR="${STAGING_DIR}"

‎.devcontainer/devcontainer.json

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"name": "C++",
55
"build": {
66
"dockerfile": "Dockerfile",
7-
"context": "..",
87

98
// Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-10, debian-9, ubuntu-20.04, ubuntu-18.04
109
"args": { "VARIANT": "debian-10" }

‎.github/workflows/build-container.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: build-container
2+
on:
3+
push:
4+
paths:
5+
- '.devcontainer/**'
6+
- '.github/workflows/build-container.yml'
7+
branches: master
8+
workflow_dispatch:
9+
10+
env:
11+
# used as the cross-toolchain release to be included into the image
12+
TOOLCHAIN_RELEASE: rpi-5.10.y
13+
14+
jobs:
15+
build-container:
16+
runs-on: 'ubuntu-20.04'
17+
steps:
18+
-
19+
name: Login to Registry
20+
uses: docker/login-action@v1
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.repository_owner }}
24+
password: ${{ secrets.CR_PAT }}
25+
26+
- name: Checkout
27+
uses: actions/checkout@v2
28+
with:
29+
submodules: recursive
30+
31+
-
32+
name: Build and push
33+
id: docker_build
34+
uses: docker/build-push-action@v2
35+
with:
36+
push: true
37+
tags: ghcr.io/${{ github.repository_owner }}/usb-proxy-dev:latest,ghcr.io/${{ github.repository_owner }}/usb-proxy-dev:${{ env.TOOLCHAIN_RELEASE }}
38+
context: .devcontainer
39+
build-args: TOOLCHAIN_RELEASE=${{ env.TOOLCHAIN_RELEASE }}

‎.github/workflows/build-deps.yaml

-40
This file was deleted.

‎.github/workflows/build-toolchain.yaml

-40
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.