Skip to content

Commit

Permalink
Move erlang installation to base image
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas committed Apr 30, 2024
1 parent 83b1975 commit f25a794
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
10 changes: 4 additions & 6 deletions stack/base-with-services/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@ RUN mamba create -p /opt/conda/envs/aiida-core-services --yes \

# Install RabbitMQ in a dedicated conda environment.
# If the architecture is arm64, we install the default version of rabbitmq provided by the generic binary,
# # https://www.rabbitmq.com/install-generic-unix.html the version needs to be compatible with system's erlang version.
# https://www.rabbitmq.com/install-generic-unix.html the version needs to be compatible with system's erlang version.
# Note that system erlang from arm64 is already installed in the base image, together with other APT dependencies
# to save build time.
RUN if [ "$TARGETARCH" = "amd64" ]; then \
mamba install -p /opt/conda/envs/aiida-core-services --yes \
rabbitmq-server=3.8.14 && \
mamba clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"; \
elif [ "$TARGETARCH" = "arm64" ]; then \
apt-get update && apt-get install -y --no-install-recommends \
erlang && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean all && \
export RMQ_VERSION=3.9.13 && \
wget -c https://github.com/rabbitmq/rabbitmq-server/releases/download/v${RMQ_VERSION}/rabbitmq-server-generic-unix-${RMQ_VERSION}.tar.xz && \
tar -xf rabbitmq-server-generic-unix-${RMQ_VERSION}.tar.xz && \
Expand All @@ -38,7 +36,7 @@ elif [ "$TARGETARCH" = "arm64" ]; then \
fix-permissions "/opt/conda/envs/aiida-core-services/rabbitmq_server-${RMQ_VERSION}" && \
ln -sf /opt/conda/envs/aiida-core-services/rabbitmq_server-${RMQ_VERSION}/sbin/* /opt/conda/envs/aiida-core-services/bin/; \
else \
echo "Unknown architecture: ${TARGETARCH}."; \
echo "Unknown architecture: ${TARGETARCH}."; \
fi

# Configure AiiDA profile.
Expand Down
9 changes: 9 additions & 0 deletions stack/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ USER root
# rsync: needed to support the new AiiDA backup command
# povray: rendering engine used in aiidalab-widgets-base
ENV EXTRA_APT_PACKAGES "curl povray rsync build-essential"

# For ARM64 we need to install erlang as it is not available on conda-forge
# (this is needed later as rabbitmq dependency in base-with-services image,
# but we install it here so that we don't have to invoke apt multiple times.
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "arm64" ]; then \
EXTRA_APT_PACKAGES="erlang "${EXTRA_APT_PACKAGES} \
fi

RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends ${EXTRA_APT_PACKAGES} && \
apt-get clean && rm -rf /var/lib/apt/lists/*
Expand Down
10 changes: 0 additions & 10 deletions stack/full-stack/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ COPY --from=base /opt/config-quick-setup.yaml /opt/
COPY --from=base "${CONDA_DIR}/envs/aiida-core-services" "${CONDA_DIR}/envs/aiida-core-services"
COPY --from=base /usr/local/bin/before-notebook.d /usr/local/bin/before-notebook.d

# This is needed because we use multi-stage build,
# the erlang package is not available after the first stage.
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "arm64" ]; then \
# Install erlang.
apt-get update --yes && \
apt-get install --yes --no-install-recommends erlang && \
apt-get clean && rm -rf /var/lib/apt/lists/*; \
fi

RUN fix-permissions "${CONDA_DIR}"
RUN fix-permissions "/home/${NB_USER}/.aiida"

Expand Down

0 comments on commit f25a794

Please sign in to comment.