31 lines
1.1 KiB
Docker
31 lines
1.1 KiB
Docker
|
|
# --- Build the .NET API ---
|
||
|
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||
|
|
WORKDIR /src
|
||
|
|
COPY dotnet/SafelyYou/SafelyYou.csproj dotnet/SafelyYou/
|
||
|
|
RUN dotnet restore dotnet/SafelyYou/SafelyYou.csproj
|
||
|
|
COPY dotnet/SafelyYou/ dotnet/SafelyYou/
|
||
|
|
RUN dotnet publish dotnet/SafelyYou/SafelyYou.csproj -c Release -o /app/publish --no-restore
|
||
|
|
|
||
|
|
# --- API runtime ---
|
||
|
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS api
|
||
|
|
RUN apt-get update \
|
||
|
|
&& apt-get install -y --no-install-recommends curl \
|
||
|
|
&& rm -rf /var/lib/apt/lists/*
|
||
|
|
WORKDIR /app
|
||
|
|
COPY --from=build /app/publish .
|
||
|
|
ENV ASPNETCORE_URLS=http://+:6733
|
||
|
|
EXPOSE 6733
|
||
|
|
HEALTHCHECK --interval=2s --timeout=2s --start-period=5s --retries=15 \
|
||
|
|
CMD curl -s -o /dev/null http://127.0.0.1:6733/ || exit 1
|
||
|
|
ENTRYPOINT ["dotnet", "SafelyYou.dll"]
|
||
|
|
|
||
|
|
# --- Device simulator (writes results.txt into /output) ---
|
||
|
|
FROM alpine:3.20 AS simulator
|
||
|
|
COPY device-simulator-linux-arm64 /usr/local/bin/device-simulator
|
||
|
|
RUN chmod +x /usr/local/bin/device-simulator \
|
||
|
|
&& mkdir -p /output \
|
||
|
|
&& chmod 0777 /output
|
||
|
|
WORKDIR /output
|
||
|
|
VOLUME ["/output"]
|
||
|
|
ENTRYPOINT ["device-simulator"]
|