运行 docker 内的 Makefile 目标
Run Makefile target inside of docker
我在 运行 在 Dockerfile 中创建目标时遇到问题。我也不确定我是否应该使用 bash
或 alpine
作为图像的基础。
生成文件:
all:
echo "all target is working"
test:
echo "test target is working"
build:
echo "build target is working"
Docker 文件:
FROM bash:latest
WORKDIR /usr/src/program
COPY Makefile Makefile
测试:
docker build . -t program
docker run program "make test"
错误:
/usr/local/bin/docker-entrypoint.sh: line 11: exec: more Makefile: not found
引号有误。你只想
docker run program make test
使用哪个基本图像完全取决于 Makefile
试图做什么。除非您专门尝试做一些特定于 Bash 的事情,否则基础 alpine
图像可能是一个很好的起点。
我在 运行 在 Dockerfile 中创建目标时遇到问题。我也不确定我是否应该使用 bash
或 alpine
作为图像的基础。
生成文件:
all:
echo "all target is working"
test:
echo "test target is working"
build:
echo "build target is working"
Docker 文件:
FROM bash:latest
WORKDIR /usr/src/program
COPY Makefile Makefile
测试:
docker build . -t program
docker run program "make test"
错误:
/usr/local/bin/docker-entrypoint.sh: line 11: exec: more Makefile: not found
引号有误。你只想
docker run program make test
使用哪个基本图像完全取决于 Makefile
试图做什么。除非您专门尝试做一些特定于 Bash 的事情,否则基础 alpine
图像可能是一个很好的起点。