Skip to content

Commit

Permalink
Merge pull request #214 from nmfs-opensci/test
Browse files Browse the repository at this point in the history
fix problem with texlive installation
  • Loading branch information
eeholmes authored Feb 6, 2025
2 parents a8f6de2 + 94b65b9 commit 396086e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LABEL org.opencontainers.image.author="[email protected]"
LABEL org.opencontainers.image.source=https://github.com/nmfs-opensci/py-rocket-base
LABEL org.opencontainers.image.description="Python (3.12), R (4.4.1), Desktop and Publishing tools"
LABEL org.opencontainers.image.licenses=Apache2.0
LABEL org.opencontainers.image.version=2024.11.24
LABEL org.opencontainers.image.version=2025.02.05

USER root

Expand All @@ -17,9 +17,9 @@ ENV REPO_DIR="/srv/repo" \
# The latest rocker will set CRAN to 'latest' but we need a date stamped version for reproducibility
# So pull the latest and use one earlier
ARG R_VERSION_PULL="4.4.2"
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8

ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
# Add NB_USER to staff group (required for rocker script)
# Ensure the staff group exists first
RUN groupadd -f staff && usermod -a -G staff "${NB_USER}"
Expand Down
33 changes: 25 additions & 8 deletions scripts/install-rocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,42 @@ rm ${TAR_NAME}.tar.gz && \
rm -rf rocker-versioned2-${TAR_NAME}

cd /

# Read the Dockerfile and process each line
in_run_block=false
cmd=""

while IFS= read -r line; do
# Check if the line starts with ENV or RUN
if [[ "$line" == ENV* ]]; then
# Assign variable
var_assignment=$(echo "$line" | sed 's/^ENV //g')
# Replace ENV DEFAULT_USER="jovyan"
if [[ "$var_assignment" == DEFAULT_USER* ]]; then
var_assignment="DEFAULT_USER=${NB_USER}"
fi
# Run this way eval "export ..." otherwise the " will get turned to %22
eval "export $var_assignment"
# Write the exported variable to env.txt
echo "export $var_assignment" >> ${REPO_DIR}/env.txt
echo "export $var_assignment" >> "${REPO_DIR}/env.txt"

elif [[ "$line" == RUN* ]]; then
# Run the command from the RUN line
# Detect start of a multi-line RUN block
if [[ "$line" =~ RUN\ \<\<([A-Za-z0-9_]+) ]]; then
in_run_block=true
cmd="" # Reset command buffer
eof_marker="${BASH_REMATCH[1]}" # Store EOF marker (e.g., EOF)
continue
fi
cmd=$(echo "$line" | sed 's/^RUN //g')
echo "Executing: $cmd"
eval "$cmd" # || echo ${cmd}" encountered an error, but continuing..."
eval "$cmd"

elif $in_run_block; then
# Detect end of the here-document
if [[ "$line" == "$eof_marker" ]]; then
in_run_block=false
echo "Executing multi-line RUN block:"
echo "$cmd"
eval "$cmd"
else
cmd+=$'\n'"$line"
fi
fi
done < /rocker_scripts/original.Dockerfile

Expand Down

0 comments on commit 396086e

Please sign in to comment.