Dockerfile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #See https://aka.ms/containerfastmode to understand 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. EXPOSE 80
  4. EXPOSE 443
  5. EXPOSE 54088
  6. EXPOSE 2222
  7. WORKDIR /app
  8. RUN apt-get update \
  9. && apt-get install -y --no-install-recommends dialog \
  10. && apt-get install -y --no-install-recommends openssh-server \
  11. && apt-get install -y tcpdump\
  12. && mkdir -p /run/sshd \
  13. && echo "root:Docker!" | chpasswd
  14. COPY sshd_config /etc/ssh/sshd_config
  15. RUN apt-get update \
  16. && apt-get install -y cron \
  17. && apt-get install -y vim \
  18. && apt-get install -y zip
  19. COPY schedule .
  20. RUN crontab schedule
  21. RUN echo 'net.ipv4.tcp_rmem= 10240 87380 12582912' >> /etc/sysctl.conf
  22. RUN echo 'net.ipv4.tcp_wmem= 10240 87380 12582912' >> /etc/sysctl.conf
  23. RUN echo 'net.ipv4.tcp_window_scaling = 1' >> /etc/sysctl.conf
  24. FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
  25. WORKDIR /src
  26. COPY ["EVCB_OCPP.WSServer/EVCB_OCPP.WSServer.csproj", "EVCB_OCPP.WSServer/"]
  27. RUN dotnet restore "EVCB_OCPP.WSServer/EVCB_OCPP.WSServer.csproj"
  28. COPY . .
  29. WORKDIR "/src/EVCB_OCPP.WSServer"
  30. RUN dotnet build "EVCB_OCPP.WSServer.csproj" -c Release -o /app/build
  31. FROM build AS publish
  32. RUN dotnet publish "EVCB_OCPP.WSServer.csproj" -c Release -o /app/publish /p:UseAppHost=false
  33. FROM base AS final
  34. WORKDIR /app
  35. COPY --from=publish /app/publish .
  36. COPY entrypoint.sh /app/entrypoint.sh
  37. COPY ssha /app/ssha
  38. RUN chmod +x /app/entrypoint.sh
  39. CMD ["/app/entrypoint.sh"]