Docker容器中Apache2中托管的ASP NET Core应用程序

时间:2018-07-11 07:06:45

标签: linux apache docker asp.net-core apache2

因此,我试图在Docker容器中的Apache2中托管一个ASP Net Core应用程序。我已将Microsoft / dotnet:latest Docker映像作为基于Debian 9的基础映像。我创建了以下Dockerfile,然后由于无法指定多个入口点来运行dotnet应用程序以及apache2作为反向代理服务器,我创建了一个supervisor.conf,它同时启用了两者。 apache2服务器仍未转发请求。请帮忙。

Dockerfile

FROM microsoft/dotnet:latest
WORKDIR /app
COPY . ./
RUN dotnet restore
RUN dotnet publish -c Release
EXPOSE 5000/tcp
EXPOSE 80
ENV ASPNETCORE_URLS http://*:5000

RUN apt-get update
RUN apt -y install apache2
RUN apt-get install -y supervisor
RUN a2enmod headers
RUN a2enmod proxy
RUN apt -y install systemd

ADD sampleapp.conf /etc/apache2/sites-available/
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf 

RUN a2ensite sampleapp.conf
ENTRYPOINT ["/usr/bin/supervisord"]
#ENTRYPOINT ["dotnet", "./SampleApplication/bin/Release/netcoreapp2.0/SampleApplication.dll"]

Sampleapp.conf

<VirtualHost *:80>
     ProxyPreserveHost On
     ProxyPass / http://127.0.0.1:5000/
     ProxyPassReverse / http://127.0.0.1:5000/        
     ErrorLog ${APACHE_LOG_DIR}sampleapp-error.log
     CustomLog ${APACHE_LOG_DIR}sampleapp-access.log common
</VirtualHost>

Supervisord.conf

[supervisord]
nodaemon=true

[program:sampleapp]
command=/bin/dotnet /app/SampleApplication/bin/Release/netcoreapp2.0/SampleApplication.dll

[program:apache2]
command=/sbin/apache2 -DFOREGROUND

因此,主管无法运行它们中的任何一个,因此我猜我指定的命令有问题,因此我从Dockerfile中删除了ENTRYPOINT ["/usr/bin/supervisord"]并试图进入容器并执行操作手动将它们放入Dockerfile中。

提前谢谢!

0 个答案:

没有答案