Good day,
I'm new with docker. I have 2 projects that have dockerfiles in each of them.
My projects are: ASP.NET Core API and Angular6
In my ASP.NET Core API project, here's my working dockerfile
FROM microsoft/dotnet:2.1-aspnetcore-runtime
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/DockerPublishedApp} .
ENTRYPOINT ["dotnet", "myapp.dll"]
I did manually published my app and it stores in my DockerPublishedApp.
In my Angular6 project, here's my working dockerfile.
FROM nginx:1.13.3-alpine
RUN rm -rf /usr/share/nginx/html/*
COPY /dist/mypublishedangularapp /usr/share/nginx/html
CMD ["nginx","-g","daemon off;"]
Both these dockerfiles are working properly when I build and run them one by one.
My main concern is, how can I convert them to docker-compose.yml
to avoid running the created image one by one.
Suppose you have the following directory structure:
/proj1 /Dockerfile /proj2 /Dockerfile /docker-compose.yml
You could have the following compose file:
version: '3.4' services: proj1: image: proj1:latest build: context: ./proj1 dockerfile: Dockerfile proj2: image: proj2:latest build: context: ./proj2 dockerfile: Dockerfile
And run docker-compose -f docker-compose.yml up --build
to build both images and run them. This will build images proj1:latest and proj2:latest.
Alternatively, if you did not want to build them, just remove the build keys, and omit --build.
To run publish out of the Dockerfile:
version: '3.4' services: proj1: image: proj1:latest build: context: ./proj1 dockerfile: Dockerfile command: dotnet publish ...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.