๐ฉโ๐ป dotnet6 ็ dockerfile
ๅปบ็ซๆชๆกโ
ๅจๅฐๆกๅบไธๅปบ็ซไธๅๆชๆก
dockerfile
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
# Copy everything
COPY . ./
# Restore as distinct layers
RUN dotnet restore
# Build and publish a release
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "Foreteller-Backend.dll"]
ๅจๅฐๆกๅบไธๅปบ็ซไธๅๆชๆก
.dockerignore
๏ผไพ้ๆฟพ็จไธๅฐ็ๆชๆก
dockerfile
.dockerignore
ๅปบ็ซ imageโ
docker build -t dotnet6-app .
ๅๅ dotnet6 ๅฎนๅจโ
docker run -p 80:3050 dotnet6-app