Skip to content

Commit 8a68e6a

Browse files
Merge pull request #7266 from bandi13/addYoctoDocker
Add in files for yocto build environment
2 parents 6f281d7 + e74d3e1 commit 8a68e6a

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

Docker/yocto/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM ubuntu
2+
3+
# Set timezone to UTC
4+
RUN ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo UTC > /etc/timezone
5+
6+
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev python3-subunit mesa-common-dev zstd liblz4-tool file locales libacl1 vim && apt clean -y && rm -rf /var/lib/apt/lists/*
7+
RUN locale-gen en_US.UTF-8
8+
9+
# Add in non-root user
10+
ENV UID_OF_DOCKERUSER 1000
11+
RUN useradd -m -s /bin/bash -g users -u ${UID_OF_DOCKERUSER} dockerUser
12+
RUN chown -R dockerUser:users /home/dockerUser && chown dockerUser:users /opt
13+
14+
USER dockerUser
15+
16+
RUN cd /opt && git clone git://git.yoctoproject.org/poky
17+
WORKDIR /opt/poky
18+
19+
ARG YOCTO_VERSION=kirkstone
20+
RUN git checkout -t origin/${YOCTO_VERSION} -b ${YOCTO_VERSION} && git pull
21+
22+
RUN /bin/bash -c "source oe-init-build-env && bitbake core-image-minimal"

Docker/yocto/buildAndPush.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# Assume we're in wolfssl/Docker/yocto
4+
WOLFSSL_DIR=$(builtin cd ${BASH_SOURCE%/*}/../..; pwd)
5+
6+
DOCKER_BUILD_OPTIONS="$1"
7+
if [ "${DOCKER_BASE_IMAGE}" != "" ]; then
8+
DOCKER_BUILD_OPTIONS+=" --build-arg DOCKER_BASE_IMAGE=${DOCKER_BASE_IMAGE}"
9+
fi
10+
11+
NUM_FAILURES=0
12+
13+
CUR_DATE=$(date -u +%F)
14+
for ver in kirkstone dunfell; do
15+
echo "Building wolfssl/yocto:${ver}-${CUR_DATE} as ${DOCKER_BUILD_OPTIONS}"
16+
docker build -t wolfssl/yocto:${ver}-${CUR_DATE} --build-arg YOCTO_VERSION=${ver} -f Dockerfile "${WOLFSSL_DIR}/Docker/yocto" && \
17+
docker tag wolfssl/yocto:${ver}-${CUR_DATE} wolfssl/yocto:${ver}-latest
18+
if [ $? -eq 0 ]; then
19+
echo "Pushing containers to DockerHub"
20+
docker push wolfssl/yocto:${ver}-${CUR_DATE} && docker push wolfssl/yocto:${ver}-latest
21+
else
22+
echo "Warning: Build wolfssl/yocto:${ver} failed. Continuing"
23+
((NUM_FAILURES++))
24+
fi
25+
done
26+
27+
echo "Script completed in $SECONDS seconds. Had $NUM_FAILURES failures."

0 commit comments

Comments
 (0)