Ngày đăng
Dec 28, 2023 1:04 AM
Tác giả
Quân Huỳnh
Dockerfile for other programing language
Normal:
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /build
# copy csproj and restore as distinct layers
COPY *.csproj .
RUN dotnet restore
# copy and publish app and libraries
COPY . .
RUN dotnet publish --no-restore -o app
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /build/app .
ENTRYPOINT ["./aspnetapp"]
Alpine version:
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
WORKDIR /build
# copy csproj and restore as distinct layers
COPY *.csproj .
RUN dotnet restore
# copy and publish app and libraries
COPY . .
RUN dotnet publish --no-restore -o app
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
WORKDIR /app
COPY --from=build /build/app .
ENTRYPOINT ["./aspnetapp"]
Nếu bài viết có gì sai hoặc cần cập nhật thì liên hệ Admin.
Tham gia nhóm chat của DevOps VN tại Telegram.
Kém tiếng Anh và cần nâng cao trình độ giao tiếp: Tại sao bạn học không hiệu quả?