-
Notifications
You must be signed in to change notification settings - Fork 527
/
Dockerfile
50 lines (37 loc) · 1.2 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
FROM mcr.microsoft.com/dotnet/sdk:8.0-cbl-mariner2.0 AS build-env
WORKDIR /App
# Copy everything
COPY . ./
# Make sure we run bash
CMD ["bash"]
# Make sure we get all the updates and tools we need to build
RUN tdnf install gawk -y
# This is Node v16. For 18, use nodejs18.
RUN tdnf install nodejs -y
RUN tdnf clean all
# Build javascript library
RUN /App/build-js.sh
# Restore
RUN dotnet restore --configfile /App/NuGet.config /App/TryDotNet.sln
# Build and publish a release
RUN dotnet publish -c Release -o out /App/src/Microsoft.TryDotNet
# Build runtime image
FROM mcr.microsoft.com/dotnet/sdk:8.0-cbl-mariner2.0
ARG TRY_DOT_NET_BUILD_ID
WORKDIR /App
# Make sure we run bash
CMD ["bash"]
# Make sure we get all the tools we need
RUN tdnf install procps -y
RUN tdnf clean all
# Copy from build image
COPY --from=build-env /App/out .
# Set up to run and expose app on port 80
EXPOSE 80
ENV ASPNETCORE_URLS=http://*:80/
# This is a workaround for the fact that the Try .NET website is not yet container-aware
ENV TRY_DOT_NET_REQUEST_SCHEME=https
ENV TRY_DOT_NET_BUILD_ID=$TRY_DOT_NET_BUILD_ID
ENV TRY_DOT_NET_MANUAL_BUILD_ID=2
# Run the Microsoft.TryDotNet website
ENTRYPOINT ["dotnet", "Microsoft.TryDotNet.dll"]