Skip to content

Commit

Permalink
Install Git in Dockerfiles for build and runtime stages
Browse files Browse the repository at this point in the history
Added an apt-get command to install Git in both the build and runtime stages of the Dockerfiles. This change ensures that Git is available for cloning repositories or other operations, facilitating smoother builds and deployments. Removed the unused Java installation stage to simplify the Dockerfile.
  • Loading branch information
Gamer-VII committed Nov 28, 2024
1 parent 1f9baf4 commit 0dd8c4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER $APP_UID
USER root
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
RUN apt-get update && apt-get install -y git
USER $APP_UID

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
Expand All @@ -21,9 +23,6 @@ FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "Gml.Web.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

# Java installation stage
FROM adoptopenjdk:11-jdk AS java

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
Expand Down
1 change: 1 addition & 0 deletions src/Gml.Web.Api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
RUN apt-get update && apt-get install -y git
COPY ["src/Gml.Web.Api/Gml.Web.Api.csproj", "src/Gml.Web.Api/"]
COPY ["src/Gml.Web.Api.Domains/Gml.Web.Api.Domains.csproj", "src/Gml.Web.Api.Domains/"]
COPY ["src/Gml.Web.Api.Dto/Gml.Web.Api.Dto.csproj", "src/Gml.Web.Api.Dto/"]
Expand Down

0 comments on commit 0dd8c4d

Please sign in to comment.