forked from microsoft/AMBROSIA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
67 lines (54 loc) · 2.8 KB
/
Dockerfile
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# FROM microsoft/dotnet:2.1-sdk
# FROM microsoft/dotnet:2.0.9-sdk-2.1.202
# FROM microsoft/dotnet:2.0-sdk
# FROM microsoft/dotnet:2.2-sdk-2.2.108 -- want this version
FROM microsoft/dotnet:2.2-sdk
RUN apt-get update -y && \
apt-get install -y libunwind-dev apache2-utils make gcc
# Add only what we need, and add late to minimize rebuilds during development:
ADD ImmortalCoordinator /ambrosia/ImmortalCoordinator
ADD Ambrosia /ambrosia/Ambrosia
ADD DevTools /ambrosia/DevTools
WORKDIR /ambrosia
ENV AMBROSIA_DOTNET_FRAMEWORK=netcoreapp2.2 \
AMBROSIA_DOTNET_CONF=Release \
AMBROSIA_DOTNET_PLATFORM=linux-x64
# This is the command we use to build each of the individual C# projects:
ENV BLDFLAGS " -c Release -f $AMBROSIA_DOTNET_FRAMEWORK -r $AMBROSIA_DOTNET_PLATFORM "
ENV BUILDIT "dotnet publish $BLDFLAGS"
# NOTE: use the following for a debug build of AMBROSIA:
# ENV BLDFLAGS " -c Debug -f netcoreapp2.2 -r linux-x64 -p:DefineConstants=DEBUG "
# (1) Build the core executables and libraries:
# ---------------------------------------------
RUN $BUILDIT -o /ambrosia/bin/runtime Ambrosia/Ambrosia/Ambrosia.csproj
RUN $BUILDIT -o /ambrosia/bin/coord ImmortalCoordinator/ImmortalCoordinator.csproj
RUN $BUILDIT -o /ambrosia/bin/unsafedereg DevTools/UnsafeDeregisterInstance/UnsafeDeregisterInstance.csproj
RUN cd bin && \
ln -s runtime/Ambrosia Ambrosia && \
ln -s coord/ImmortalCoordinator && \
ln -s unsafedereg/UnsafeDeregisterInstance
# (2) Language binding: CSharp (depends on AmbrosiaLibCS on nuget)
# ----------------------------------------------------------------
ADD Clients/CSharp /ambrosia/Clients/CSharp
RUN $BUILDIT -o /ambrosia/bin/codegen Clients/CSharp/AmbrosiaCS/AmbrosiaCS.csproj && \
cd bin && ln -s codegen/AmbrosiaCS
# (2B) Reduce the size of our dotnet binary distribution:
ADD ./Scripts/dedup_bindist.sh Scripts/
RUN du -sch ./bin && \
./Scripts/dedup_bindist.sh && \
du -sch ./bin
# (3) Low-level Native-code network client:
# -----------------------------------------
ADD Clients/C /ambrosia/Clients/C
# This publishes to the build directory: bin/lib*.* and bin/include
RUN cd Clients/C && make debug # publish
# (4) A script used by apps to start the ImmortalCoordinator:
# -----------------------------------------------------------
ADD ./Scripts/runAmbrosiaService.sh bin/
# We currently use this as a baseline source of dependencies for generated code:
ADD ./Clients/CSharp/AmbrosiaCS/AmbrosiaCS.csproj bin/AmbrosiaCS.csproj
# Remove unnecessary execute permissions:
# RUN cd bin && (chmod -x *.dll *.so *.dylib *.a 2>/dev/null || echo ok)
# Make "ambrosia", "AmbrosiaCS", and "ImmortalCoordinator" available on PATH:
ENV AMBROSIA_BINDIR="/ambrosia/bin" \
PATH="${PATH}:/ambrosia/bin"