所以,我最近遇到了一個我想在 dotnet 中構建的 dockerise 專案(我應該注意我不是 .net 開發人員)
該 repo 可以在這里找到以供參考:
https://github.com/observerly/ASCOM.Alpaca.Simulators
我已經盡我最大的努力來設定以下 Dockerfile 以便能夠容器化這個應用程式:
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /app
# copy NuGet config
COPY NuGet.config .
# copy csproj and restore as distinct layers
COPY *.sln .
COPY ASCOM.Alpaca.Simulators/*.csproj ./ASCOM.Alpaca.Simulators/
COPY Camera.Simulator/*.csproj ./Camera.Simulator/
COPY CoverCalibratorSimulator/*.csproj ./CoverCalibratorSimulator/
COPY DomeSimulator/*.csproj ./DomeSimulator/
COPY FilterWheelSimulator/*.csproj ./FilterWheelSimulator/
COPY FocuserSimulator/*.csproj ./FocuserSimulator/
COPY ObservingConditionsSimulator/*.csproj ./ObservingConditionsSimulator/
COPY OmniSim.Tools/*.csproj ./OmniSim.Tools/
COPY RotatorSimulator/*.csproj ./RotatorSimulator/
COPY SafetyMonitorSimulator/*.csproj ./SafetyMonitorSimulator/
COPY SwitchSimulator/*.csproj ./SwitchSimulator/
COPY TelescopeSimulator/*.csproj ./TelescopeSimulator/
# copy WindowsBase.Vector
COPY WindowsBase.Vector/*.sln ./WindowsBase.Vector/
COPY WindowsBase.Vector/WindowsBase.Vector/*.csproj ./WindowsBase.Vector/WindowsBase.Vector/
RUN dotnet restore
# copy everything else and build app
COPY ASCOM.Alpaca.Simulators/. ./ASCOM.Alpaca.Simulators/
COPY Camera.Simulator/. ./Camera.Simulator/
COPY CoverCalibratorSimulator/. ./CoverCalibratorSimulator/
COPY DomeSimulator/. ./DomeSimulator/
COPY FilterWheelSimulator/. ./FilterWheelSimulator/
COPY FocuserSimulator/. ./FocuserSimulator/
COPY ObservingConditionsSimulator/. ./ObservingConditionsSimulator/
COPY OmniSim.Tools/. ./OmniSim.Tools/
COPY RotatorSimulator/. ./RotatorSimulator/
COPY SafetyMonitorSimulator/. ./SafetyMonitorSimulator/
COPY SwitchSimulator/. ./SwitchSimulator/
COPY TelescopeSimulator/. ./TelescopeSimulator/
WORKDIR /app/ASCOM.Alpaca.Simulators
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
WORKDIR /app
COPY --from=build /app/ASCOM.Alpaca.Simulators/out ./
ENTRYPOINT ["dotnet", "ASCOM.Alpaca.Simulators.dll"]
但是,我遇到以下錯誤堆疊:
#44 4.204 /app/TelescopeSimulator/AstronomyFunctions.cs(282,23): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.205 /app/TelescopeSimulator/AstronomyFunctions.cs(379,47): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.205 /app/TelescopeSimulator/AstronomyFunctions.cs(379,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.205 /app/TelescopeSimulator/AstronomyFunctions.cs(395,47): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.205 /app/TelescopeSimulator/AstronomyFunctions.cs(395,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.205 /app/TelescopeSimulator/MountFunctions.cs(25,51): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.206 /app/TelescopeSimulator/MountFunctions.cs(25,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.206 /app/TelescopeSimulator/MountFunctions.cs(64,52): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.207 /app/TelescopeSimulator/MountFunctions.cs(64,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.207 /app/TelescopeSimulator/MountFunctions.cs(97,51): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.207 /app/TelescopeSimulator/MountFunctions.cs(97,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.207 /app/TelescopeSimulator/MountFunctions.cs(123,52): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.207 /app/TelescopeSimulator/MountFunctions.cs(123,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.207 /app/TelescopeSimulator/MountFunctions.cs(159,42): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.208 /app/TelescopeSimulator/MountFunctions.cs(159,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.208 /app/TelescopeSimulator/MountFunctions.cs(168,43): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.209 /app/TelescopeSimulator/MountFunctions.cs(168,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.209 /app/TelescopeSimulator/MountFunctions.cs(177,41): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.210 /app/TelescopeSimulator/MountFunctions.cs(177,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.210 /app/TelescopeSimulator/TelescopeHardware.cs(1497,43): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.210 /app/TelescopeSimulator/TelescopeHardware.cs(1517,42): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.211 /app/TelescopeSimulator/TelescopeHardware.cs(1670,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.212 /app/TelescopeSimulator/TelescopeHardware.cs(1786,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.212 /app/TelescopeSimulator/TelescopeHardware.cs(1843,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.212 /app/TelescopeSimulator/TelescopeHardware.cs(1933,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.212 /app/TelescopeSimulator/TelescopeHardware.cs(158,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.213 /app/TelescopeSimulator/TelescopeHardware.cs(163,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.213 /app/TelescopeSimulator/TelescopeHardware.cs(168,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.214 /app/TelescopeSimulator/TelescopeHardware.cs(173,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.214 /app/TelescopeSimulator/TelescopeHardware.cs(193,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.214 /app/TelescopeSimulator/TelescopeHardware.cs(200,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.215 /app/TelescopeSimulator/TelescopeHardware.cs(202,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.215 /app/TelescopeSimulator/TelescopeHardware.cs(219,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.215 /app/TelescopeSimulator/TelescopeHardware.cs(224,24): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.216 /app/TelescopeSimulator/TelescopeHardware.cs(249,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.216 /app/TelescopeSimulator/TelescopeHardware.cs(254,25): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.216 /app/TelescopeSimulator/TelescopeHardware.cs(265,23): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.217 /app/TelescopeSimulator/TelescopeHardware.cs(274,23): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
#44 4.217 /app/TelescopeSimulator/TelescopeHardware.cs(279,23): error CS0246: The type or namespace name 'Vector' could not be found (are you missing a using directive or an assembly reference?) [/app/TelescopeSimulator/TelescopeSimulator.csproj]
任何人都可以為我提供任何能夠解決這個瑣碎問題的指示嗎?
我的懷疑是它與嵌套WindowsBase.Vector情況有關......
uj5u.com熱心網友回復:
您的錯誤是您從未將 WindowsBase.Vector 專案的代碼復制到容器中。在此塊中添加最后一行。
# copy everything else and build app
COPY ASCOM.Alpaca.Simulators/. ./ASCOM.Alpaca.Simulators/
COPY Camera.Simulator/. ./Camera.Simulator/
COPY CoverCalibratorSimulator/. ./CoverCalibratorSimulator/
COPY DomeSimulator/. ./DomeSimulator/
COPY FilterWheelSimulator/. ./FilterWheelSimulator/
COPY FocuserSimulator/. ./FocuserSimulator/
COPY ObservingConditionsSimulator/. ./ObservingConditionsSimulator/
COPY OmniSim.Tools/. ./OmniSim.Tools/
COPY RotatorSimulator/. ./RotatorSimulator/
COPY SafetyMonitorSimulator/. ./SafetyMonitorSimulator/
COPY SwitchSimulator/. ./SwitchSimulator/
COPY TelescopeSimulator/. ./TelescopeSimulator/
COPY WindowsBase.Vector/. ./WindowsBase.Vector/
但不是單獨復制每個專案,你可以這樣做
# copy everything else and build app
COPY . .
并立即復制所有內容。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/431605.html
標籤:C# 。网 码头工人 asp.net 核心 .net-core
下一篇:Docker安裝不同版本的git
