File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,24 +100,13 @@ jobs:
100100 registry : ghcr.io
101101 username : ${{ github.actor }}
102102 password : ${{ secrets.GITHUB_TOKEN }}
103-
104- - name : Build custom base image
105- run : |
106- cat << 'EOF' > base.Dockerfile
107- FROM mcr.microsoft.com/dotnet/aspnet:8.0
108- RUN apt-get update && apt-get install -y curl unzip \
109- && curl -fsSL https://bun.sh/install | bash \
110- && mv /root/.bun/bin/bun /usr/local/bin/ \
111- && apt-get clean \
112- && rm -rf /var/lib/apt/lists/*
113- EOF
114- docker build -f base.Dockerfile -t docker.io/dotnet-bun-base:latest .
115103
116- - name : Publish container
117- run : |
118- dotnet publish --os linux --arch x64 /t:PublishContainer \
119- -p:ContainerBaseImage=docker.io/dotnet-bun-base:latest \
120- -p:ContainerRegistry=ghcr.io \
121- -p:ContainerImageTags=latest \
122- -p:ContainerPort=80 \
123- -p:ContainerRepository=${{ env.image_repository_name }}
104+ - name : Build and push
105+ uses : docker/build-push-action@v5
106+ with :
107+ context : .
108+ push : true
109+ tags : |
110+ ghcr.io/${{ env.image_repository_name }}:latest
111+ ghcr.io/${{ env.image_repository_name }}:${{ github.sha }}
112+ platforms : linux/amd64
Original file line number Diff line number Diff line change 1+ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
2+ WORKDIR /app
3+ EXPOSE 8080
4+
5+ # Install bun
6+ RUN apt-get update && apt-get install -y curl unzip \
7+ && curl -fsSL https://bun.sh/install | bash \
8+ && mv /root/.bun/bin/bun /usr/local/bin/ \
9+ && apt-get clean \
10+ && rm -rf /var/lib/apt/lists/*
11+
12+ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
13+ WORKDIR /src
14+ COPY ["MyApp/MyApp.csproj" , "MyApp/" ]
15+ RUN dotnet restore "MyApp/MyApp.csproj"
16+ COPY . .
17+ WORKDIR "/src/MyApp"
18+ RUN dotnet build "MyApp.csproj" -c Release -o /app/build
19+
20+ FROM build AS publish
21+ RUN dotnet publish "MyApp.csproj" -c Release -o /app/publish /p:UseAppHost=false
22+
23+ FROM base AS final
24+ WORKDIR /app
25+ COPY --from=publish /app/publish .
26+ ENTRYPOINT ["dotnet" , "MyApp.dll" ]
You can’t perform that action at this time.
0 commit comments