Merge pull request #883 from ucb-bar/root-dockerfile
Use root user for the Dockerfile
This commit is contained in:
@@ -6,13 +6,13 @@ version: 2.1
|
|||||||
parameters:
|
parameters:
|
||||||
tools-cache-version:
|
tools-cache-version:
|
||||||
type: string
|
type: string
|
||||||
default: "v8"
|
default: "v9"
|
||||||
|
|
||||||
# default execution env.s
|
# default execution env.s
|
||||||
executors:
|
executors:
|
||||||
main-env:
|
main-env:
|
||||||
docker:
|
docker:
|
||||||
- image: ucbbar/chipyard-ci-image:c29770
|
- image: ucbbar/chipyard-ci-image:1d51bb90
|
||||||
environment:
|
environment:
|
||||||
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
|
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ commands:
|
|||||||
- save_cache:
|
- save_cache:
|
||||||
key: << parameters.tools-version >>-installed-<< pipeline.parameters.tools-cache-version >>-{{ checksum "../<< parameters.tools-version >>.hash" }}
|
key: << parameters.tools-version >>-installed-<< pipeline.parameters.tools-cache-version >>-{{ checksum "../<< parameters.tools-version >>.hash" }}
|
||||||
paths:
|
paths:
|
||||||
- "/home/riscvuser/<< parameters.tools-version >>-install"
|
- "/root/<< parameters.tools-version >>-install"
|
||||||
|
|
||||||
ssh-checkout:
|
ssh-checkout:
|
||||||
description: "Add SSH key and checkout code"
|
description: "Add SSH key and checkout code"
|
||||||
@@ -95,7 +95,7 @@ commands:
|
|||||||
- save_cache:
|
- save_cache:
|
||||||
key: << parameters.group-key >>-{{ .Branch }}-{{ .Revision }}
|
key: << parameters.group-key >>-{{ .Branch }}-{{ .Revision }}
|
||||||
paths:
|
paths:
|
||||||
- "/home/riscvuser/project"
|
- "/root/project"
|
||||||
|
|
||||||
run-tests:
|
run-tests:
|
||||||
description: "Run a set of tests"
|
description: "Run a set of tests"
|
||||||
@@ -190,7 +190,7 @@ jobs:
|
|||||||
- save_cache:
|
- save_cache:
|
||||||
key: extra-tests-{{ .Branch }}-{{ .Revision }}
|
key: extra-tests-{{ .Branch }}-{{ .Revision }}
|
||||||
paths:
|
paths:
|
||||||
- "/home/riscvuser/project/tests"
|
- "/root/project/tests"
|
||||||
|
|
||||||
prepare-chipyard-cores:
|
prepare-chipyard-cores:
|
||||||
executor: main-env
|
executor: main-env
|
||||||
|
|||||||
@@ -17,19 +17,7 @@ RUN apt-get update && \
|
|||||||
keyboard-configuration \
|
keyboard-configuration \
|
||||||
console-setup
|
console-setup
|
||||||
|
|
||||||
# Adds a new user called riscvuser
|
WORKDIR /root
|
||||||
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"
|
|
||||||
|
|
||||||
# Install Chipyard and run ubuntu-req.sh to install necessary dependencies
|
# Install Chipyard and run ubuntu-req.sh to install necessary dependencies
|
||||||
RUN git clone https://github.com/ucb-bar/chipyard.git && \
|
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 && \
|
./scripts/ubuntu-req.sh 1>/dev/null && \
|
||||||
sudo rm -rf /var/lib/apt/lists/*
|
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
|
# BUILD IMAGE WITH TOOLCHAINS
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
# used with the dockerfile to set up enviroment variables by running env.sh
|
# 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
|
# 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 "$@"
|
exec "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user