-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (35 loc) · 1.66 KB
/
Copy pathDockerfile
File metadata and controls
45 lines (35 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# syntax=docker/dockerfile:1.7
# =============================================================================
# fsharp - classical cipher cryptanalysis
# =============================================================================
# Multi-stage: dotnet/sdk:10.0-alpine builds, dotnet/runtime:10.0-alpine runs.
# Same Arcp NuGet umbrella as csharp. The bundled samples/corpus are tiny, so
# the image stays light while the demo gets useful test input.
# -----------------------------------------------------------------------------
FROM mcr.microsoft.com/dotnet/sdk:10.0-alpine AS build
ARG ARCP_SDK_VERSION=1.0.0
WORKDIR /src
COPY ArcpExample.fsproj nuget.config ./
COPY src/ ./src/
COPY samples/ ./samples/
COPY corpora/ ./corpora/
# Stub Program.fs so verify builds before code is added.
RUN if ! ls src/*.fs >/dev/null 2>&1; then \
printf 'module ArcpExample.Main\nlet main () = printfn "arcp fsharp example stub"\n[<EntryPoint>]\nlet entry _ = main (); 0\n' \
> src/Program.fs; \
fi
# `latest` uses NuGet floating `*`; otherwise pin. The default is pinned until
# the 1.0.1 umbrella package has matching component packages on NuGet.
RUN if [ "$ARCP_SDK_VERSION" = "latest" ]; then \
dotnet restore /p:ArcpVersion=*; \
else \
dotnet restore /p:ArcpVersion="${ARCP_SDK_VERSION}"; \
fi
RUN dotnet publish -c Release -o /out --no-restore /p:UseAppHost=false
# -----------------------------------------------------------------------------
FROM mcr.microsoft.com/dotnet/runtime:10.0-alpine AS runtime
RUN apk add --no-cache tini ca-certificates
WORKDIR /app
COPY --from=build /out/ .
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["dotnet", "/app/ArcpExample.dll"]