FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build WORKDIR /source COPY Nyangate.sln ./ COPY src/Nyangate/*.csproj ./src/Nyangate/ COPY src/Nyangate.Cli/*.csproj ./src/Nyangate.Cli/ COPY src/Nyangate.Lib/*.csproj ./src/Nyangate.Lib/ COPY test/Nyangate.Test/*.csproj ./test/Nyangate.Test/ RUN dotnet restore COPY src/Nyangate/. ./src/Nyangate/ COPY src/Nyangate.Lib/. ./src/Nyangate.Lib/ RUN dotnet publish ./src/Nyangate/Nyangate.csproj --no-restore -c Release -o /build/nyangate FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine AS tests WORKDIR /source COPY test/Nyangate.Test/. ./test/Nyangate.Test/ RUN dotnet test FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine AS runtime # Environment vars ENV TLS_CERT_PUB=/etc/tls/certs/main.pem ENV TLS_CERT_PRIVKEY=/etc/tls/certs/main.key.pem RUN mkdir -p /srv/nyangate/config /etc/tls/certs # Files COPY --from=build /build/nyangate /srv/nyangate #COPY ./scripts/chkhealth /usr/bin/ VOLUME [ "/srv/nyangate/config" ] WORKDIR /srv/nyangate # Net EXPOSE 80/tcp EXPOSE 443/tcp # Process handling STOPSIGNAL SIGTERM #HEALTHCHECK --interval=60s --timeout=30s --start-period=5s --retries=3 CMD [ "/usr/bin/chkhealth" ] ENTRYPOINT [ "dotnet", "/srv/nyangate/Nyangate.dll" ]