This commit is contained in:
@@ -161,8 +161,7 @@ steps:
|
||||
echo "$PNAME" | tr 'A-Z' 'a-z' | tr -d '\n' >> /tmp/tag.txt
|
||||
|
||||
echo "$PNAME" > /tmp/pname.txt
|
||||
|
||||
cd "${PDIR}"
|
||||
echo "$PDIR" | sed 's|^\./||' > /tmp/pdir.txt
|
||||
|
||||
cat > "Dockerfile.temp" <<'ENDOFDOCKERFILE'
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
@@ -171,8 +170,8 @@ steps:
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
WORKDIR /src
|
||||
COPY . .
|
||||
RUN dotnet restore "%%PROJECTNAME%%.csproj"
|
||||
RUN dotnet publish "%%PROJECTNAME%%.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
RUN dotnet restore "%%PROJECTDIR%%/%%PROJECTNAME%%.csproj"
|
||||
RUN dotnet publish "%%PROJECTDIR%%/%%PROJECTNAME%%.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/publish .
|
||||
@@ -181,7 +180,8 @@ steps:
|
||||
ENDOFDOCKERFILE
|
||||
|
||||
REAL_PNAME=$(cat /tmp/pname.txt)
|
||||
sed "s/%%PROJECTNAME%%/$REAL_PNAME/g" "Dockerfile.temp" > "Dockerfile.final"
|
||||
REAL_PDIR=$(cat /tmp/pdir.txt)
|
||||
sed "s|%%PROJECTNAME%%|$REAL_PNAME|g; s|%%PROJECTDIR%%|$REAL_PDIR|g" "Dockerfile.temp" > "Dockerfile.final"
|
||||
|
||||
docker buildx build \
|
||||
--platform linux/amd64 \
|
||||
@@ -194,6 +194,5 @@ steps:
|
||||
docker push "$(cat /tmp/tag.txt):latest"
|
||||
|
||||
rm -f "Dockerfile.temp" "Dockerfile.final"
|
||||
cd "${CI_WORKSPACE}"
|
||||
done
|
||||
depends_on: [select-projects-for-container]
|
||||
|
||||
Reference in New Issue
Block a user