Merge pull request #883 from ucb-bar/root-dockerfile

Use root user for the Dockerfile
This commit is contained in:
Abraham Gonzalez
2021-05-13 16:41:31 -05:00
committed by GitHub
3 changed files with 11 additions and 19 deletions

View File

@@ -6,13 +6,13 @@ version: 2.1
parameters:
tools-cache-version:
type: string
default: "v8"
default: "v9"
# default execution env.s
executors:
main-env:
docker:
- image: ucbbar/chipyard-ci-image:c29770
- image: ucbbar/chipyard-ci-image:1d51bb90
environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
@@ -41,7 +41,7 @@ commands:
- save_cache:
key: << parameters.tools-version >>-installed-<< pipeline.parameters.tools-cache-version >>-{{ checksum "../<< parameters.tools-version >>.hash" }}
paths:
- "/home/riscvuser/<< parameters.tools-version >>-install"
- "/root/<< parameters.tools-version >>-install"
ssh-checkout:
description: "Add SSH key and checkout code"
@@ -95,7 +95,7 @@ commands:
- save_cache:
key: << parameters.group-key >>-{{ .Branch }}-{{ .Revision }}
paths:
- "/home/riscvuser/project"
- "/root/project"
run-tests:
description: "Run a set of tests"
@@ -190,7 +190,7 @@ jobs:
- save_cache:
key: extra-tests-{{ .Branch }}-{{ .Revision }}
paths:
- "/home/riscvuser/project/tests"
- "/root/project/tests"
prepare-chipyard-cores:
executor: main-env

View File

@@ -17,19 +17,7 @@ RUN apt-get update && \
keyboard-configuration \
console-setup
# Adds a new user called riscvuser
RUN groupadd --gid 3434 riscvuser \
&& useradd --uid 3434 --gid riscvuser --shell /bin/bash --create-home riscvuser \
&& echo 'riscvuser ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-riscvuser \
&& echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep
WORKDIR /home/riscvuser
USER riscvuser
# Update PATH for RISCV toolchain (note: hardcoded for CircleCI)
ENV RISCV="/home/riscvuser/riscv-tools-install"
ENV LD_LIBRARY_PATH="$RISCV/lib"
ENV PATH="$RISCV/bin:$PATH"
WORKDIR /root
# Install Chipyard and run ubuntu-req.sh to install necessary dependencies
RUN git clone https://github.com/ucb-bar/chipyard.git && \
@@ -38,6 +26,10 @@ RUN git clone https://github.com/ucb-bar/chipyard.git && \
./scripts/ubuntu-req.sh 1>/dev/null && \
sudo rm -rf /var/lib/apt/lists/*
# Update PATH for RISCV toolchain (note: hardcoded for CircleCI)
ENV RISCV="/root/riscv-tools-install"
ENV LD_LIBRARY_PATH="$RISCV/lib"
ENV PATH="$RISCV/bin:$PATH"
# BUILD IMAGE WITH TOOLCHAINS

View File

@@ -3,6 +3,6 @@
# used with the dockerfile to set up enviroment variables by running env.sh
# adapted from https://stackoverflow.com/questions/55921914/how-to-source-a-script-with-environment-variables-in-a-docker-build-process
. /home/riscvuser/chipyard/env.sh
. /root/chipyard/env.sh
exec "$@"