Dockerfile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
  2. #Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
  3. #For more information, please see https://aka.ms/containercompat
  4. FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
  5. RUN apt-get update \
  6. && apt-get install -y --no-install-recommends dialog \
  7. && apt-get install -y --no-install-recommends openssh-server \
  8. && apt-get install -y tcpdump\
  9. && mkdir -p /run/sshd \
  10. && echo "root:Docker!" | chpasswd
  11. COPY sshd_config /etc/ssh/sshd_config
  12. RUN sed -i 's/TLSv1.2/TLSv1/g' /etc/ssl/openssl.cnf
  13. RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /etc/ssl/openssl.cnf
  14. WORKDIR /app
  15. EXPOSE 80
  16. EXPOSE 443
  17. FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
  18. WORKDIR /src
  19. COPY ["EVCB_OCPP.WEBAPI/EVCB_OCPP.WEBAPI.csproj", "EVCB_OCPP.WEBAPI/"]
  20. RUN dotnet restore "EVCB_OCPP.WEBAPI/EVCB_OCPP.WEBAPI.csproj"
  21. COPY . .
  22. WORKDIR "/src/EVCB_OCPP.WEBAPI"
  23. RUN dotnet build "EVCB_OCPP.WEBAPI.csproj" -c Release -o /app/build
  24. FROM build AS publish
  25. RUN dotnet publish "EVCB_OCPP.WEBAPI.csproj" -c Release -o /app/publish /p:UseAppHost=false
  26. FROM base AS final
  27. WORKDIR /app
  28. COPY --from=publish /app/publish .
  29. COPY entrypoint.sh .
  30. RUN chmod +x /app/entrypoint.sh
  31. CMD ["/app/entrypoint.sh"]