8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

构建多阶段docker时遇到的一个问题

Medhansh Garg 2月前

9 0

我有一个多阶段 Docker 文件,尝试构建它时出现错误。我希望缓存 R 包以加快 docker 构建速度。此外,它还连接到 gitlab CI/CD 以进行自动部署...

我有一个多阶段 Docker 文件,在尝试构建它时出现错误。我希望缓存 R 包以加快 Docker 构建速度。此外,它还连接到 gitlab CI/CD 以自动部署到 Cloud run

# Stage 1: Install R and R packages in a separate build stage
FROM r-base:4.4.1  as r-build

# Install necessary system dependencies
RUN 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 packages
RUN Rscript -e "install.packages('forecast', dependencies=TRUE)"
RUN Rscript -e "install.packages('lubridate')"
RUN Rscript -e "install.packages('googleCloudStorageR')"

# Stage 2: Build the final image
FROM ubuntu:latest as final_stage

# Copy the installed R libraries from the previous stage
COPY --from=r-build /usr/local/lib/R/site-library /usr/local/lib/R/site-library

# Set non-interactive frontend for apt-get
ENV DEBIAN_FRONTEND=noninteractive
ARG ENV=test

# Install necessary system dependencies
RUN 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 directory
WORKDIR /home/app

# Copy over requirements.txt and upgrade pip and setuptools before installing dependencies
COPY requirements.txt .
RUN python3 -m pip install --upgrade pip setuptools
RUN python3 -m pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code
COPY config/config_$ENV.py ./config/config.py
COPY run.py .
COPY startup_docker.sh .
COPY setup.sh .
COPY app ./app
COPY app/credentials.json credentials.json

# Ensure scripts have execution permissions
RUN 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 script
CMD ["python3", "/home/app/run.py"]

这是错误

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 installed
Depends: r-recommended (= 4.4.1-1.2204.0) but it is not going to be installed
Recommends: r-base-html but it is not going to be installed
Recommends: r-doc-html but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
帖子版权声明 1、本帖标题:构建多阶段docker时遇到的一个问题
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由Medhansh Garg在本站《ubuntu》版块原创发布, 转载请注明出处!
最新回复 (0)
返回
作者最近主题: