-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfs.Dockerfile
48 lines (36 loc) · 1.21 KB
/
cfs.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM ubuntu:jammy AS cfs-dev
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y build-essential gdb nano cmake git pkg-config sudo && rm -rf /var/lib/apt/lists/*
# Switch to bash shell
SHELL ["/bin/bash", "-c"]
# Create a brash user
ENV USERNAME brash_user
ENV HOME_DIR=/home/${USERNAME}
ENV CODE_DIR=/code
ENV CFS_LOCAL=cFS
# Dev container arguments
ARG USER_UID=1000
ARG USER_GID=${USER_UID}
# Create new user and home directory
RUN groupadd --gid ${USER_GID} ${USERNAME} \
&& useradd --uid ${USER_UID} --gid ${USER_GID} --create-home ${USERNAME} \
&& echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME} \
&& mkdir -p ${CODE_DIR} \
&& chown -R ${USER_UID}:${USER_GID} ${CODE_DIR}
USER ${USERNAME}
# Set workdir
WORKDIR ${CODE_DIR}/cFS/build/exe/cpu2
##################################################
# Production
##################################################
FROM cfs-dev AS cfs
# Copy cFS
COPY --chown=${USERNAME}:${USERNAME} ${CFS_LOCAL} ${CODE_DIR}/cFS
# Build cFS
WORKDIR ${CODE_DIR}/cFS
RUN make SIMULATION=native prep && \
make && \
make install
# Dev environment has cFS built on mount volume
WORKDIR ${CODE_DIR}/cFS/build/exe/cpu2