Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUN usermod -u takes 45min during image building #1493

Open
ReHoss opened this issue Apr 9, 2024 · 0 comments
Open

RUN usermod -u takes 45min during image building #1493

ReHoss opened this issue Apr 9, 2024 · 0 comments

Comments

@ReHoss
Copy link

ReHoss commented Apr 9, 2024

Hi,

First, sorry If it is not the right place to ask this question. In that case, please refer me where to submit my request.

Building a container with the Dockerfile below takes 45min at the usermod stage.

Is this behaviour normal? Note, firedrake-vanilla is a quite heavy image.

Best,

  • Build command:
docker build \
  --tag "$TAG_IMAGE" \
  --build-arg USER_ID="$(id -u)" \
  --build-arg GROUP_ID="$(id -g)" \
  --progress=plain \
  "$PATH_DOCKERFILE_DIR"
  • Dockerfile:
FROM firedrakeproject/firedrake-vanilla:latest
LABEL authors="hosseinkhan"


# Source the firedrake environment
ENV PATH_FIREDRAKE_VENV_ACTIVATION_SCRIPT=/home/firedrake/firedrake/bin/activate \
    URL_HYDROGYM=https://github.com/ReHoss/hydrogym.git@main

RUN /bin/bash -c "source $PATH_FIREDRAKE_VENV_ACTIVATION_SCRIPT && \
    pip install --upgrade pip && \
    pip install git+$URL_HYDROGYM && \
    pip install  \
    cma \
    colorednoise \
    gpflow \
    git+https://github.com/j-wilson/GPflowSampling.git@develop \
    gymnasium \
    jax \
    jaxlib \
    matplotlib \
    mlflow==1.27.0 \
    omegaconf \
    pystan \
    pyyaml \
    scikit-learn \
    scipy \
    tf_keras \
    tqdm"


# Create a directory for mounting
RUN mkdir -p /home/firedrake/mount_dir/project_root/


# PRINT THE CURRENT ENVIRONMENT TO THE TERMINAL
RUN /bin/bash -c "echo 'Current python: $(which python)' && \
    echo 'Current pip: $(which pip)' && \
    echo 'Current python version: $(python --version)' && \
    echo 'Current pip version: $(pip --version)' && \
    echo 'Current pip list: $(pip list)'"

# Firedrake change uid approach
USER root
ARG USER_ID
ARG GROUP_ID
RUN usermod -u $USER_ID firedrake
RUN groupmod -g $GROUP_ID firedrake

USER firedrake

ENTRYPOINT ["/bin/bash", "-l", "-c", "source /home/firedrake/firedrake/bin/activate && /bin/bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant