Adding new Dockerfile

This commit is contained in:
Benjamin
2024-11-22 09:23:43 +01:00
parent 198c5ccd5c
commit a10982edf7
2 changed files with 17 additions and 16 deletions

View File

@@ -1,36 +1,39 @@
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. # Base image for runtime
# This stage is used when running from VS in fast mode (Default for Debug configuration)
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app USER app
WORKDIR /app WORKDIR /app
EXPOSE 8080 EXPOSE 8080
EXPOSE 8081 EXPOSE 8081
# Build stage for ASP.NET Core
# This stage is used to build the service project
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release
WORKDIR /src WORKDIR /src
COPY ["pointMaster/pointMaster.csproj", "pointMaster/"] COPY ["pointMaster.csproj", "./"]
RUN dotnet restore "./pointMaster/pointMaster.csproj" RUN dotnet restore "./pointMaster.csproj"
COPY . . COPY . .
WORKDIR "/src/pointMaster" WORKDIR "/src"
RUN dotnet build "./pointMaster.csproj" -c $BUILD_CONFIGURATION -o /app/build RUN dotnet build "./pointMaster.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM node:20 AS node-build # Build stage for Vue.js app
FROM node:18 AS node-build
WORKDIR /js-app WORKDIR /js-app
COPY ["js/package.json", "js/package-lock.json*", "./"] COPY ["js/package.json", "js/package-lock.json*", "./"]
RUN npm install RUN npm install
COPY js/ . COPY js/ .
RUN npm run build RUN npm run build
RUN ls -la /js-app
RUN ls -la /wwwroot/js/dist
# This stage is used to publish the service project to be copied to the final stage # Publish ASP.NET Core app
FROM build AS publish FROM build AS publish
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./pointMaster.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false RUN dotnet publish "./pointMaster.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration) # Copy Vue.js build output to ASP.NET Core wwwroot
COPY --from=node-build /wwwroot/js/dist /app/publish/wwwroot/js/dist
# Final runtime stage
FROM base AS final FROM base AS final
WORKDIR /app WORKDIR /app
COPY --from=publish /app/publish . COPY --from=publish /app/publish .

View File

@@ -12,13 +12,11 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@vue/cli-plugin-typescript": "^5.0.8", "@vue/cli-plugin-typescript": "^5.0.8",
"@vue/cli-service": "^5.0.8",
"apexcharts": "^4.0.0", "apexcharts": "^4.0.0",
"axios": "^1.7.7", "axios": "^1.7.7",
"vue": "^3.5.13", "vue": "^3.5.13"
"vue-class-component": "^7.2.6"
}, },
"devDependencies": { "devDependencies": {
"vue-cli-service": "^5.0.10" "@vue/cli-service": "^5.0.8"
} }
} }