From 53030642798ae03f7893c5c28e1e59e119c093d9 Mon Sep 17 00:00:00 2001 From: M Starch Date: Wed, 4 Aug 2021 19:10:09 -0700 Subject: [PATCH] lestarch: reworking docker to only include the fprime-base (#894) --- docker/Dockerfile | 41 ++--------------------------------------- docker/README.md | 18 ++---------------- 2 files changed, 4 insertions(+), 55 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index c4ec20ea5c..17c6a5b0c4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -22,7 +22,8 @@ RUN groupadd fprime && \ bash git build-essential cmake time python3 python3-setuptools python3-pip python3-venv valgrind && \ mkdir -p /opt/ && chown fprime:fprime /opt/ && \ git clone --quiet https://github.com/raspberrypi/tools.git /opt/rpi/tools && \ - apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + pip3 install --no-cache-dir fprime-tools fprime-gds # Change user and group of the virtual environment # Make fprime user default user ENV HOST fprime @@ -31,41 +32,3 @@ ENV LANG C.UTF-8 ENV LC_ALL C.UTF-8 USER fprime ENTRYPOINT ["/bin/bash"] - -### **** **** Add Non-CI Images Here **** **** ### -FROM fprime-base AS fprime-docker -RUN git clone --quiet https://github.com/nasa/fprime.git /opt/fprime && \ - python3 -m venv /opt/fprime-venv/ && . /opt/fprime-venv/bin/activate && \ - pip install --no-cache-dir fprime-tools fprime-gds && \ - rm -r ~/.cache/pip && \ - chown -R fprime:fprime /opt/fprime-venv && \ - chmod -R 775 /opt/fprime-venv -ENV VIRTUAL_ENV "/opt/fprime-venv" -ENV PATH "/opt/fprime-venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - -#### -# F Prime CI Image: **** Must Be Last Image In File **** -# -# This sets up an image for use within a CI build system. This is currently configured for the -# Jenkins CI system. This means a Jenkins user is created, setup and ready to run. -# -# This is the last image in the file because the Jenkins server used by F prime does not expose -# the --target argument for building the docker image. As such, this image is the one built and -# used for Jenkins. -#### -FROM fprime-docker AS jenkins-ci -USER root -RUN groupadd jenkins && \ - groupmod -g 1003 jenkins && \ - useradd -ms /bin/bash -g root -G sudo,jenkins,fprime -p jenkins jenkins && \ - usermod -u 1003 jenkins && \ - usermod -a -G fprime jenkins -USER jenkins -ENV HOST jenkins -ENV USER jenkins -# Paths and entrypoints -ENV PATH "/opt/fprime-venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" -ENV LANG C.UTF-8 -ENV LC_ALL C.UTF-8 -ENV CI_CLEAN_REPO "NO_REALLY_I_WANT_TO_NUKE_ALL_YOUR_BASE" -ENTRYPOINT ["/bin/bash"] diff --git a/docker/README.md b/docker/README.md index 7d219ce3ac..73b83ad6bf 100644 --- a/docker/README.md +++ b/docker/README.md @@ -13,10 +13,7 @@ the need to ensure every worker has F´ build dependencies installed. Our Dockerfile is organized into substages. The first stage is setup with just the tools installed and the entrypoint is setup to be a generic `bash` prompt. This stage may be used for projects -that want their developers using Docker as an environment. The other stage is the Jenkins-CI stage -that adds in the needed user setup for running continuous integration on Jenkins CI. -> **Note:** F´ CI using GitHub actions is done off from the base image, as these Actions do not require extensive -user setup like Jenkins. +that want their developers using Docker as an environment. ### Building Docker Images @@ -29,16 +26,10 @@ as few files as possible. **Build fprime-base** ``` -cd fprime/mk/docker +cd fprime/docker docker build --target fprime-base -t fprime-base:latest . ``` -**Build fprime-ci** -``` -cd fprime/mk/docker -docker build --target jenkins-ci -t fprime-base:latest . -``` - ### Publishing Docker Image to DockerHub DockerHub hosts images that can be built upon and downloaded directly. F´ publishes our fprime-base @@ -66,11 +57,6 @@ packages, running the ubuntu-packages script, and install the pip dependencies. app-cache is cleaned. Doing all this in one step prevents excessive Docker image size bloat by reducing the number of temporary file system layers. -The user "jenkins" is created, given root permissions, and set as the user for when the -container is run. The PATH and ENTRYPOINT is set for when the container runs. Currently, the ENTRYPOINT -is set to a `bash` shell such that the container will provide a terminal and "run forever", which is -needed for Jenkins CI. - ## Manual Docker Usage Should a user need to run this docker image for purposes other than CI, docker can be run manually to