Junior — Middle
Do you have practical experience using Docker in projects?
sobes.tech AI
Answer from AI
Yes, I have used Docker for containerizing applications in C#. For example, I created Dockerfiles for ASP.NET Core applications, which allowed for quick deployment of services in an isolated environment. This simplified deployment and ensured a consistent environment across different stages of development and production.
Here's an example of a simple Dockerfile for ASP.NET Core:
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["MyApp.csproj", "."]
RUN dotnet restore "MyApp.csproj"
COPY . .
RUN dotnet build "MyApp.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "MyApp.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "MyApp.dll"]