对于VS 2017中的asp核心项目模板,有docker-compose.ci.build.yml:
For a asp core project template in VS 2017, there are docker-compose.ci.build.yml:
version: '3' services: ci-build: image: microsoft/aspnetcore-build:1.0-2.0 volumes: - .:/src working_dir: /src command: /bin/bash -c "dotnet restore ./WebAppCoreDockerTest.sln && dotnet publish ./WebAppCoreDockerTest.sln -c Release -o ./obj/Docker/publish"docker-compose.yml:
docker-compose.yml:
version: '3' services: webappcoredockertest: image: webappcoredockertest ports: - 8080:80 build: context: ./WebAppCoreDockerTest dockerfile: Dockerfile和Dockerfile:
and Dockerfile:
FROM microsoft/aspnetcore:2.0 ARG source WORKDIR /app EXPOSE 80 RUN echo "Oh dang look at that $source" COPY ${source:-obj/Docker/publish} . ENTRYPOINT ["dotnet", "WebAppCoreDockerTest.dll"]Dockerfile使用文件在obj / Docker / publish(复制到容器)中,如果源参数为null,并且docker-compose.ci.build.yml将项目推向obj / Docker / publish,我认为它们是相关的。
The Dockerfile uses the files in obj/Docker/publish (copied to container) if source argument is null and docker-compose.ci.build.yml puhlishs project to obj/Docker/publish, I assume they are related.
所以问题是如何一起使用? (docker-compose.ci.build.yml将文件发布到obj / Docker / publish,并且Dockerfile使用已发布的文件)
So the question is How to use them together? (docker-compose.ci.build.yml publishes files to obj/Docker/publish and Dockerfile use published files)
推荐答案The如您所述, docker-compose.ci.build.yml 文件用于构建项目。它使用 aspnetcore-build 基本映像,该映像比Dockerfile使用的 aspnetcore 映像要重得多。 Dockerfile 被docker-compose.yml文件的 build 部分使用。
The docker-compose.ci.build.yml file is for building the project, as you mentioned. It uses the aspnetcore-build base image which is much heftier than the aspnetcore image used by the Dockerfile. The Dockerfile gets used by the build section of the docker-compose.yml file.
一切都可以通过以下两个步骤来完成:
Everything works together with these two steps:
第一个命令中的 -f 选项可让您指定撰写默认文件 docker-compose.yml 以外的文件。
The -f option in the first command allows you to specify a compose file other than the default docker-compose.yml.
更多推荐
带Linux Docker容器的Asp.net核心
发布评论