FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /source
COPY *.sln .
COPY OCRApi/*.csproj ./OCRApi/
COPY OCRCore/*.csproj ./OCRCore/
COPY Migrators/Migrators.Firebird/*.csproj ./Migrators/Migrators.Firebird/
COPY Migrators/Migrators.PostgreSQL/*.csproj ./Migrators/Migrators.PostgreSQL/
RUN dotnet restore
COPY OCRApi/. ./OCRApi/
COPY OCRCore/. ./OCRCore/
COPY Migrators/Migrators.Firebird/. ./Migrators/Migrators.Firebird/
COPY Migrators/Migrators.PostgreSQL/. ./Migrators/Migrators.PostgreSQL/
WORKDIR /source/OCRCore
RUN dotnet publish -c release -o /app --no-restore
FROM python:slim as python
RUN python -m venv /venv
COPY OCRScript/requirements.txt .
RUN /venv/bin/python -m pip install -r requirements.txt
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
COPY OCRScript/. ./OCRScript/
COPY --from=build /app .
COPY --from=python /venv /python
ENV ASPNETCORE_ENVIRONMENT Development
ENTRYPOINT ["dotnet", "OCRCore.dll"]