Duplicating the Dockerfile was not needed! It builds correctly on dev computer using the following command line : docker run --rm -it -v ${PWD}:/sources -u $(id -u ${USER}):$(id -g ${USER}) jf002/infinitime-build.

This commit is contained in:
Jean-François Milants 2022-05-10 20:38:42 +02:00
parent a35cd45b33
commit b86fecdcb8
4 changed files with 1 additions and 61 deletions

View File

@ -22,7 +22,7 @@ jobs:
build:
runs-on: ubuntu-latest
container:
image: jf002/infinitime-build-github
image: jf002/infinitime-build
steps:
- name: Checkout source files
uses: actions/checkout@v2

View File

@ -73,14 +73,3 @@ The `PUID` and `PGID` build arguments are used to set the user and group ids use
```bash
docker image build -t infinitime-build --build-arg PUID=$(id -u) --build-arg PGID=$(id -g) ./docker
```
## Docker image for Github Actions
The Github Action workflow also uses the build docker container to build the project in the cloud. However, due to [some limitations](https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions) the container must be slightly modified to run in the Github Actions environment : the `USER` instruction cannot be used in Github. This means that the container runs as the default user (root), and that all the files created by the users will belong to root. That's probably fine for Docker Actions, but it's not convenient when the container is used on a personal computer : only root will be able to modify or delete the files created by the container.
For this reason, we decided to create an alternative Dockerfile (`docker/Dockerfile-github`) and to build a [second docker image](https://hub.docker.com/repository/docker/jf002/infinitime-build-github) that are intended be used exclusively on Github Action.
To build this image:
```bash
docker image build -t jf002/infinitime-build-github -f ./docker/Dockerfile-github ./docker
```

View File

@ -39,11 +39,5 @@ RUN bash -c "source /opt/build.sh; GetNrfSdk;"
# McuBoot
RUN bash -c "source /opt/build.sh; GetMcuBoot;"
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
CMD ["/opt/build.sh"]

View File

@ -1,43 +0,0 @@
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq \
&& apt-get install -y \
# x86_64 / generic packages
bash \
build-essential \
cmake \
git \
make \
python3 \
python3-pip \
tar \
unzip \
wget \
# aarch64 packages
libffi-dev \
libssl-dev \
python3-dev \
python \
git \
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*;
# Git needed for PROJECT_GIT_COMMIT_HASH variable setting
RUN pip3 install adafruit-nrfutil
RUN pip3 install -Iv cryptography==3.3
RUN pip3 install cbor
# build.sh knows how to compile
COPY build.sh /opt/
# Lets get each in a separate docker layer for better downloads
# GCC
RUN bash -c "source /opt/build.sh; GetGcc;"
# NrfSdk
RUN bash -c "source /opt/build.sh; GetNrfSdk;"
# McuBoot
RUN bash -c "source /opt/build.sh; GetMcuBoot;"
ENV SOURCES_DIR /sources
CMD ["/opt/build.sh"]