39 lines
1.6 KiB
Docker
39 lines
1.6 KiB
Docker
# 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.
|
|
|
|
# This stage is used when running from VS in fast mode (Default for Debug configuration)
|
|
#FROM mcr.microsoft.com/dotnet/aspnet:9::.0 AS base
|
|
ARG BUILD_CONFIGURATION=Release
|
|
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
|
WORKDIR /src
|
|
COPY ["FamilyTreeAPI/FamilyTreeAPI.csproj", "FamilyTreeAPI/"]
|
|
RUN dotnet restore "./FamilyTreeAPI/FamilyTreeAPI.csproj"
|
|
COPY . .
|
|
WORKDIR "/src/FamilyTreeAPI"
|
|
RUN dotnet build "./FamilyTreeAPI.csproj" -c Release -o /app/build
|
|
|
|
# create directory for import folder, and image folder
|
|
RUN mkdir /app_import
|
|
|
|
RUN mkdir /app_images
|
|
|
|
VOLUME /app_import
|
|
|
|
VOLUME /app_images
|
|
# docker run -v my_path_name_volume_host:/app_import my_image_name
|
|
# docker run -v my_path_named_volume_host:/app_images my_image_name
|
|
# docker cp /home/user/my_app/config.json my_container:/app/config.json
|
|
# docker cp /home/user/my_app/data my_container:/app/data ### copy folder data
|
|
# docker cp mycontainer:/app/output.txt /home/user/documents/
|
|
|
|
# This stage is used to publish the service project to be copied to the final stage
|
|
FROM build AS publish
|
|
|
|
RUN dotnet publish "./FamilyTreeAPI.csproj" -c Release -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)
|
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
|
|
WORKDIR /app
|
|
ENV ASPNETCORE_HTTP_PORTS=8080
|
|
EXPOSE 8080
|
|
COPY --from=publish /app/publish .
|
|
ENTRYPOINT ["dotnet", "FamilyTreeAPI.dll"] |