Dockerfile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
  2. FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
  3. WORKDIR /app
  4. EXPOSE 80
  5. EXPOSE 443
  6. RUN apt-get update \
  7. && apt-get install -y --no-install-recommends dialog \
  8. && apt-get install -y --no-install-recommends openssh-server \
  9. && apt-get install -y tcpdump\
  10. && mkdir -p /run/sshd \
  11. && echo "root:Docker!" | chpasswd
  12. COPY sshd_config /etc/ssh/sshd_config
  13. FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
  14. WORKDIR /src
  15. COPY ["CAUtilLib/CAUtilLib.csproj", "CAUtilLib/"]
  16. COPY ["CertificateAutorityServer/CertificateAutorityServer.csproj", "CertificateAutorityServer/"]
  17. RUN dotnet restore "CAUtilLib/CAUtilLib.csproj"
  18. RUN dotnet restore "CertificateAutorityServer/CertificateAutorityServer.csproj"
  19. COPY . .
  20. WORKDIR "/src/CertificateAutorityServer"
  21. RUN dotnet build "CertificateAutorityServer.csproj" -c Release -o /app/build
  22. FROM build AS publish
  23. RUN dotnet publish "CertificateAutorityServer.csproj" -c Release -o /app/publish /p:UseAppHost=false
  24. FROM base AS final
  25. WORKDIR /app
  26. COPY --from=publish /app/publish .
  27. COPY entrypoint.sh .
  28. RUN chmod +x /app/entrypoint.sh
  29. CMD ["/app/entrypoint.sh"]