![](/img/trans.png)
[英]Cloud Build fails to deploy Cloud Run after started using Google Cloud Kubernetes Cluster
[英]Using Kaniko cache with Google Cloud Build for Google Cloud Kubernetes Deployments
我们一直在通过构建触发器为我们的 GitHub 存储库使用 Google Cloud Build,该存储库包含通过 Google Cloud Kubernetes 集群部署的 C++ 应用程序。
如上所示,我们的构建配置来自 Dockerfile,它位于我们的 GitHub 存储库中。
一切都按预期工作,但是我们的构建持续了大约 55 分钟以上。 我想按照 [here] 的建议添加 Kaniko 缓存支持,但是 Google Cloud 文档仅建议一种通过 yaml 文件添加它的方法,如下所示:
steps:
- name: 'gcr.io/kaniko-project/executor:latest'
args:
- --destination=gcr.io/$PROJECT_ID/image
- --cache=true
- --cache-ttl=XXh
如何使用基于 Dockerfile 的触发器实现 Kaniko 构建?
FROM --platform=amd64 ubuntu:22.10
ENV GCSFUSE_REPO gcsfuse-stretch
RUN apt-get update && apt-get install --yes --no-install-recommends \
ca-certificates \
curl \
gnupg \
&& echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" \
| tee /etc/apt/sources.list.d/gcsfuse.list \
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
&& apt-get update \
&& apt-get install --yes gcsfuse \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
EXPOSE 80
RUN \
sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \
apt-get update && \
apt-get -y upgrade && \
apt-get install -y build-essential && \
apt-get install -y gcc && \
apt-get install -y software-properties-common && \
apt install -y cmake && \
apt-get install -y make && \
apt-get install -y clang && \
apt-get install -y mesa-common-dev && \
apt-get install -y git && \
apt-get install -y xorg-dev && \
apt-get install -y nasm && \
apt-get install -y byobu curl git htop man unzip vim wget && \
rm -rf /var/lib/apt/lists/*
# Update and upgrade repo
RUN apt-get update -y -q && apt-get upgrade -y -q
COPY . /app
RUN cd /app
RUN ls -la
# Set environment variables.
ENV HOME /root
ENV WDIR /app
# Define working directory.
WORKDIR /app
RUN cd /app/lib/glfw && cmake -G "Unix Makefiles" && make && apt-get install libx11-dev
RUN apt-cache policy libxrandr-dev
RUN apt install libxrandr-dev
RUN cd /app/lib/ffmpeg && ./configure && make && make install
RUN cmake . && make
# Define default command.
CMD ["bash"]
任何建议都非常受欢迎。
正如我在评论中提到的,您只能将您的 kaniko 添加到您的cloudbuild.yaml
文件中,因为它也是此github 链接中显示的唯一选项,但您可以添加--dockerfile
参数来查找您的 Z3254677A7917C6C5FFB86
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.