【发布时间】:2019-10-25 06:03:06
【问题描述】:
我正在尝试构建一个精简的 alpine docker 容器,用于在 Google Cloud Build 中对 Lua 进行单元测试。
它运行良好,但构建大约需要 30 - 50 秒。当我运行 busted 和 luacheck 时,每个只需要几秒钟。关于如何优化此构建过程的任何想法?
我使用 wget,然后切换到 git。我添加了 curl 和 unzip ,因为 luarocks 期望它和 openssl 用于 luacheck 的依赖项之一。我可以/应该使用不同的依赖项吗?
FROM alpine
ENV LUA_VERSION 5.1
RUN apk update
RUN apk add lua${LUA_VERSION}
RUN apk add lua${LUA_VERSION}-dev
RUN apk add bash build-base curl git openssl unzip
RUN cd /tmp && \
git clone https://github.com/keplerproject/luarocks.git && \
cd luarocks && \
sh ./configure && \
make build install && \
cd && \
rm -rf /tmp/luarocks
RUN luarocks install busted
RUN luarocks install luacheck
RUN luarocks install luacov
【问题讨论】:
-
每次构建之间有什么变化?
-
我正在使用 Google Cloud Build GitHub 应用程序并为“推送到分支”触发它。是这个意思吗?
标签: docker google-cloud-build luarocks