昨天,今天,明天,每天的每天,你是否都多懂得一点点...

星期四, 三月 15, 2018

Build and publish a docker image to docker hub

​​

To build a docker image, you only need a single docker file

Dockerfile


From microsoft/aspnetcore:2.0
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install zip socat supervisor
RUN mkdir /app
COPY FiddlerOrchestra.Client.NetCore.WindowsMacLinux.zip /app
RUN cd app && unzip /app/FiddlerOrchestra.Client.NetCore.WindowsMacLinux.zip
RUN rm /app/FiddlerOrchestra.Client.NetCore.WindowsMacLinux.zip
EXPOSE 8801 8866 8855 8877
WORKDIR /app
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf 
ENTRYPOINT ["/usr/bin/supervisord"]


In this docker file, I created a new image based on  microsoft/aspnetcore:2.0

And I copied  FiddlerOrchestra app into the image for running.

I used  supervisor to run two tasks

The content of  supervisord.conf:

[supervisord]
nodaemon=true

[program:socat]
command=socat TCP4-LISTEN:8801,fork TCP4:localhost:8800

[program:fiddler]
command=dotnet /app/FiddlerOrchestra.Client.NetCore.dll

Once you've got this ready, you can simply build the docker image with a single command. 

docker build .


Once built, you can publish it to Docker Hub. You will need to create an account first.



docker login --username=fennng





docker tag fiddler-orchestra fennng/fiddler-orchestra:1.0




docker push fennng/fiddler-orchestra










--
Feng

没有评论:

其它博客地址

此博客的同步博客地址: http://fengnz.wordpress.com
这里进入我的MSN SPACE.