Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6176

An issue when building multistage docker

$
0
0

I have a Multistage Docker file and I am getting an error when trying to build it. I want R packages to be cached to make docker builds faster. Also this is connected to gitlab CI/CD for auto deployment to Cloud run

# Stage 1: Install R and R packages in a separate build stageFROM r-base:4.4.1  as r-build# Install necessary system dependenciesRUN apt-get update && apt-get install -y \    software-properties-common \    dirmngr \    gnupg \    apt-transport-https \    ca-certificates \    lsb-release \    wget \    libcurl4-openssl-dev \    libssl-dev \    libxml2-dev \    libxt-dev# Install R packagesRUN Rscript -e "install.packages('forecast', dependencies=TRUE)"RUN Rscript -e "install.packages('lubridate')"RUN Rscript -e "install.packages('googleCloudStorageR')"# Stage 2: Build the final imageFROM ubuntu:latest as final_stage# Copy the installed R libraries from the previous stageCOPY --from=r-build /usr/local/lib/R/site-library /usr/local/lib/R/site-library# Set non-interactive frontend for apt-getENV DEBIAN_FRONTEND=noninteractiveARG ENV=test# Install necessary system dependenciesRUN apt-get update && apt-get install -y \    install r-base \    build-essential \    python3-dev \    libffi-dev \    libssl-dev \    libxml2-dev \    libxslt1-dev \    libcurl4-openssl-dev \    zlib1g-dev \    libjpeg-dev \    libpng-dev \    r-base \    systemd \    libstdc++6 \&& apt-get clean \&& rm -rf /var/lib/apt/lists/*# Set the working directoryWORKDIR /home/app# Copy over requirements.txt and upgrade pip and setuptools before installing dependenciesCOPY requirements.txt .RUN python3 -m pip install --upgrade pip setuptoolsRUN python3 -m pip install --no-cache-dir -r requirements.txt# Copy the rest of the application codeCOPY config/config_$ENV.py ./config/config.pyCOPY run.py .COPY startup_docker.sh .COPY setup.sh .COPY app ./appCOPY app/credentials.json credentials.json# Ensure scripts have execution permissionsRUN chmod +x /home/app/setup.sh /home/app/startup_docker.sh# Run the setup script (this is where R packages might be installed)RUN ./setup.sh# Set the entrypoint to the startup scriptCMD ["python3", "/home/app/run.py"]

Here is the error

The following packages have unmet dependencies:r-base : Depends: r-base-core (>= 4.4.1-1.2204.0) but it is not going to be installedDepends: r-recommended (= 4.4.1-1.2204.0) but it is not going to be installedRecommends: r-base-html but it is not going to be installedRecommends: r-doc-html but it is not going to be installedE: Unable to correct problems, you have held broken packages.

Viewing all articles
Browse latest Browse all 6176

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>