Skip to content

Commit

Permalink
Revise useradd and further consolidation
Browse files Browse the repository at this point in the history
  • Loading branch information
bdevans committed Feb 21, 2024
1 parent 6c63a4d commit 2bf9938
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,44 +84,44 @@ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1

# Create user and working directory for Chaste files
# Allow CHASTE_DIR to be set at build time if desired
ARG USER="chaste"
ARG CHASTE_DIR="/home/${USER}"
ENV USER=${USER} \
GROUP=${USER} \
PASSWORD=${USER}
RUN useradd -ms /bin/bash ${USER} && echo "${USER}:${PASSWORD}" | chpasswd && adduser ${USER} sudo

# Allow CHASTE_DIR to be set at build time if desired
ARG CHASTE_DIR="/home/${USER}"
ENV CHASTE_DIR=${CHASTE_DIR}
WORKDIR ${CHASTE_DIR}
PASSWORD=${USER} \
CHASTE_DIR=${CHASTE_DIR}
# RUN useradd -ms /bin/bash ${USER} && echo "${USER}:${PASSWORD}" | chpasswd && adduser ${USER} sudo
RUN useradd -ms /bin/bash -d ${CHASTE_DIR} ${USER} -G users,sudo && \
echo "${USER}:${PASSWORD}" | chpasswd

# Add scripts
# COPY --chown=chaste:chaste scripts "${CHASTE_DIR}/scripts"
COPY --chown=${USER}:${GROUP} scripts "${CHASTE_DIR}/scripts"

USER ${USER}
WORKDIR ${CHASTE_DIR}

RUN pip install --upgrade pip
# Install TextTest for regression testing (this requires pygtk)
RUN pip install texttest
ENV TEXTTEST_HOME /usr/local/bin/texttest
# Installed by CMake
RUN pip install chaste-codegen
# Install TextTest for regression testing (requires pygtk) and chaste-codegen
# NOTE: chaste-codegen is usually installed by CMake
RUN pip install --upgrade pip && \
pip install texttest \
chaste-codegen

# Set environment variables
# RUN source /home/chaste/scripts/set_env_vars.sh
ENV PATH="${CHASTE_DIR}/scripts:${PATH}" \
CHASTE_SOURCE_DIR="${CHASTE_DIR}/src" \
CHASTE_BUILD_DIR="${CHASTE_DIR}/build" \
CHASTE_PROJECTS_DIR="${CHASTE_DIR}/src/projects" \
CHASTE_TEST_OUTPUT="${CHASTE_DIR}/output" \
PYTHONPATH="${CHASTE_BUILD_DIR}/python:$PYTHONPATH"
# CMake environment variables
ARG CMAKE_BUILD_TYPE="Debug"
ARG Chaste_ERROR_ON_WARNING="ON"
ARG Chaste_UPDATE_PROVENANCE="OFF"
# RUN source /home/chaste/scripts/set_env_vars.sh
ENV CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
Chaste_ERROR_ON_WARNING=${Chaste_ERROR_ON_WARNING} \
Chaste_UPDATE_PROVENANCE=${Chaste_UPDATE_PROVENANCE}
Chaste_UPDATE_PROVENANCE=${Chaste_UPDATE_PROVENANCE} \
CHASTE_SOURCE_DIR="${CHASTE_DIR}/src" \
CHASTE_BUILD_DIR="${CHASTE_DIR}/build" \
CHASTE_PROJECTS_DIR="${CHASTE_DIR}/src/projects" \
CHASTE_TEST_OUTPUT="${CHASTE_DIR}/output" \
PATH="${CHASTE_DIR}/scripts:${PATH}" \
PYTHONPATH="${CHASTE_BUILD_DIR}/python:$PYTHONPATH" \
TEXTTEST_HOME=/usr/local/bin/texttest

# Create Chaste build, projects and output folders
RUN mkdir -p "${CHASTE_SOURCE_DIR}" "${CHASTE_BUILD_DIR}" "${CHASTE_TEST_OUTPUT}"
Expand Down

0 comments on commit 2bf9938

Please sign in to comment.