File size: 1,203 Bytes
ac85ccd
 
a4fc6fd
 
ac85ccd
a4fc6fd
 
 
ac85ccd
 
 
 
a4fc6fd
ac85ccd
 
 
 
a4fc6fd
ac85ccd
 
 
a4fc6fd
b4294ef
ac85ccd
 
 
 
a4fc6fd
ac85ccd
a4fc6fd
ac85ccd
 
 
 
a4fc6fd
ac85ccd
 
 
 
 
 
 
 
 
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
# syntax=docker/dockerfile:1

# STAGE 1: Use the pre-built .NET SDK to skip the massive 250MB manual download
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build

# Quickly install Node.js for the React build
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
    && apt-get install -y nodejs \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /src

# Restore and install dependencies
COPY RankingApp.csproj ./
COPY ClientApp/package*.json ./ClientApp/
RUN cd ClientApp && npm ci --no-audit --no-fund

# Copy the rest of the code and publish the app
COPY . .
RUN dotnet publish RankingApp.csproj -c Release -o /app/publish /p:UseAppHost=false

# STAGE 2: Lightweight Runtime
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime

ENV ASPNETCORE_ENVIRONMENT=Production \
    DOTNET_PRINT_TELEMETRY_MESSAGE=false

# Install PHP for your tierapp backend
RUN apt-get update \
    && apt-get install -y --no-install-recommends bash php-cli php-mysql php-curl \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy the compiled .NET/React app and PHP scripts
COPY --from=build /app/publish ./
COPY tierapp ./tierapp
COPY start.sh ./start.sh

RUN chmod +x ./start.sh

EXPOSE 10000

CMD ["/app/start.sh"]