From b86fecdcb828ad73d664f27b561499cabcd2b90e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Milants?= Date: Tue, 10 May 2022 20:38:42 +0200 Subject: [PATCH] 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. --- .github/workflows/main.yml | 2 +- doc/buildWithDocker.md | 11 ---------- docker/Dockerfile | 6 ------ docker/Dockerfile-github | 43 -------------------------------------- 4 files changed, 1 insertion(+), 61 deletions(-) delete mode 100644 docker/Dockerfile-github diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 44f65777..4bf4c95d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/doc/buildWithDocker.md b/doc/buildWithDocker.md index 35cb168a..cfd054fb 100644 --- a/doc/buildWithDocker.md +++ b/doc/buildWithDocker.md @@ -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 -``` \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 2d703285..7924bf81 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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"] diff --git a/docker/Dockerfile-github b/docker/Dockerfile-github deleted file mode 100644 index 7924bf81..00000000 --- a/docker/Dockerfile-github +++ /dev/null @@ -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"]