Integrate improvements from #137

Also fixed a bug with empty quoted strings
This commit is contained in:
Joe Eaves
2020-12-18 17:58:34 +00:00
parent a7df0a0279
commit 60ef9b54fb
4 changed files with 67 additions and 54 deletions

View File

@@ -1,16 +1,24 @@
FROM ubuntu:18.04
RUN \
apt-get update -qq && \
apt-get install -y \
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq \
&& apt-get install -y \
# x86_64 / generic packages
bash git gosu \
cmake make build-essential \
wget unzip \
python3 python3-pip \
bash \
build-essential \
cmake \
git \
make \
python3 \
python3-pip \
tar \
unzip \
wget \
# aarch64 packages
libffi-dev libssl-dev python3-dev \
&& rm -rf /var/lib/apt/lists/*;
libffi-dev \
libssl-dev \
python3-dev \
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*;
RUN pip3 install adafruit-nrfutil
@@ -25,13 +33,10 @@ RUN bash -c "source /opt/build.sh; GetNrfSdk;"
# McuBoot
RUN bash -c "source /opt/build.sh; GetMcuBoot;"
# Set and arg and use it in the env for power to override at build AND runtime
ARG USER_ID=33333
ARG GROUP_ID=33333
ENV USER_ID $USER_ID
ENV GROUP_ID $GROUP_ID
ARG PUID=1000
ARG PGID=1000
RUN groupadd --system --gid $PGID infinitime && useradd --system --uid $PUID --gid $PGID infinitime
USER infinitime:infinitime
ENV SOURCES_DIR /sources
COPY entrypoint.sh /opt/
ENTRYPOINT ["/opt/entrypoint.sh"]
CMD ["/opt/build.sh"]

View File

@@ -27,7 +27,7 @@ main() {
mkdir -p "$BUILD_DIR"
CmakeGenerate
CmakeBuild "$target"
CmakeBuild $target
if [[ "$DISABLE_POSTBUILD" != "true" ]]; then
source "$BUILD_DIR/post_build.sh"
@@ -67,7 +67,7 @@ CmakeGenerate() {
CmakeBuild() {
local target="$1"
[[ -n "$target" ]] && target="--target $target"
cmake --build "$BUILD_DIR" --config $BUILD_TYPE "$target" -- -j$(nproc)
cmake --build "$BUILD_DIR" --config $BUILD_TYPE $target -- -j$(nproc)
}
[[ $SOURCED == "false" ]] && main "$@" || echo "Sourced!"

View File

@@ -1,7 +0,0 @@
#!/bin/bash
set -e
## Create a user on-the-fly before running CMD
## This allows us to override at runtime, allowing use of a pre-built docker image
addgroup --gid $GROUP_ID user
adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user
exec gosu user:user /bin/bash -c "$@"