Updated docker config to work on the server.
This commit is contained in:
@@ -6,9 +6,6 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders>
|
<OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders>
|
||||||
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
||||||
<WasmAllowUndefinedSymbols>true</WasmAllowUndefinedSymbols>
|
|
||||||
<RunAOTCompilation>true</RunAOTCompilation>
|
|
||||||
<WasmShellGenerateAOTProfile>true</WasmShellGenerateAOTProfile>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
31
Dockerfile
31
Dockerfile
@@ -1,5 +1,5 @@
|
|||||||
# Build stage
|
# Build stage
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS launch
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
# Install Python (required for AOT compilation)
|
# Install Python (required for AOT compilation)
|
||||||
@@ -7,28 +7,21 @@ RUN apt-get update && \
|
|||||||
apt-get install -y python3 && \
|
apt-get install -y python3 && \
|
||||||
ln -s /usr/bin/python3 /usr/bin/python
|
ln -s /usr/bin/python3 /usr/bin/python
|
||||||
|
|
||||||
|
|
||||||
# Update workloads and SDK
|
|
||||||
RUN dotnet --list-sdks
|
|
||||||
RUN dotnet --list-runtimes
|
|
||||||
RUN dotnet workload update
|
|
||||||
|
|
||||||
# Copy project and solution files
|
|
||||||
COPY *.csproj *.sln ./
|
|
||||||
|
|
||||||
# Install required workloads
|
# Install required workloads
|
||||||
RUN dotnet workload install wasm-tools
|
RUN dotnet workload install wasm-tools
|
||||||
|
|
||||||
|
# Copy project and solution files
|
||||||
|
COPY *.csproj ./
|
||||||
|
RUN dotnet restore
|
||||||
|
|
||||||
# Copy the rest of the application
|
# Copy the rest of the application
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Restore dependencies
|
# Publish the app
|
||||||
RUN dotnet restore
|
RUN dotnet publish -c Release -o /app/publish
|
||||||
|
|
||||||
# Publish the app (optional, if you want to test publish output)
|
|
||||||
# RUN dotnet publish -c Release -o /app/publish
|
|
||||||
|
|
||||||
# Runtime stage: Use the SDK image to run the app
|
|
||||||
ENTRYPOINT ["dotnet", "run", "--no-launch-profile", "--urls", "http://0.0.0.0:5000"]
|
|
||||||
EXPOSE 5000
|
|
||||||
|
|
||||||
|
# Runtime stage: Use Nginx to serve static files
|
||||||
|
FROM nginx:alpine
|
||||||
|
COPY --from=build /app/publish/wwwroot /usr/share/nginx/html
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
EXPOSE 80
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
version: '3.8'
|
version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
web:
|
wattif:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:80"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf
|
||||||
|
|||||||
18
nginx.conf
Normal file
18
nginx.conf
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
types {
|
||||||
|
application/wasm wasm;
|
||||||
|
application/manifest+json webmanifest;
|
||||||
|
application/octet-stream dll pdb webcil;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user