Fix Docker build context path in CI configuration and add Dockerfile for multi-stage build #5
This commit is contained in:
@@ -69,7 +69,7 @@ docker-build:
|
|||||||
- ip a
|
- ip a
|
||||||
- docker info
|
- docker info
|
||||||
script:
|
script:
|
||||||
- docker build -t centrum-api:latest -f Api/Dockerfile .
|
- docker build -t centrum-api:latest -f Dockerfile .
|
||||||
|
|
||||||
docker-deploy:
|
docker-deploy:
|
||||||
stage: release
|
stage: release
|
||||||
|
|||||||
24
Dockerfile
Normal file
24
Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Build Angular Web app
|
||||||
|
FROM node:24 AS web-build
|
||||||
|
WORKDIR /app/web
|
||||||
|
COPY Web/package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
COPY Web/ ./
|
||||||
|
RUN npm run build -- --output-path=dist/Web/browser
|
||||||
|
|
||||||
|
# Build .NET Api app
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS api-build
|
||||||
|
WORKDIR /app/api
|
||||||
|
COPY Api/*.csproj ./
|
||||||
|
RUN dotnet restore
|
||||||
|
COPY Api/ ./
|
||||||
|
RUN dotnet publish Api.csproj -c Release -o /app/api/build
|
||||||
|
|
||||||
|
# Final runtime image
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=api-build /app/api/build ./
|
||||||
|
COPY --from=web-build /app/web/dist/Web/browser ./wwwroot
|
||||||
|
ENV ASPNETCORE_URLS=http://+:5000
|
||||||
|
EXPOSE 5000
|
||||||
|
ENTRYPOINT ["dotnet", "Api.dll"]
|
||||||
Reference in New Issue
Block a user