@@ -93,21 +93,31 @@ jobs:
9393
9494 - name : Set up Docker Buildx
9595 uses : docker/setup-buildx-action@v3
96-
97- # Build custom base image first
96+
97+ - name : Login to Container Registry
98+ uses : docker/login-action@v3
99+ with :
100+ registry : ghcr.io
101+ username : ${{ github.actor }}
102+ password : ${{ secrets.GITHUB_TOKEN }}
103+
98104 - name : Build custom base image
99105 run : |
100106 cat << 'EOF' > base.Dockerfile
101107 FROM mcr.microsoft.com/dotnet/aspnet:8.0
102108 RUN apt-get update && apt-get install -y curl unzip \
103- && curl -fsSL https://bun.sh/install | bash \
104- && mv /root/.bun/bin/bun /usr/local/bin/ \
105- && apt-get clean \
106- && rm -rf /var/lib/apt/lists/*
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/*
107113 EOF
108-
109- docker build -f base.Dockerfile -t dotnet-bun-base .
110-
111- - name : Build and push Docker image
114+ docker build -f base.Dockerfile -t docker.io/dotnet-bun-base:latest .
115+
116+ - name : Publish container
112117 run : |
113- dotnet publish --os linux --arch x64 -c Release /p:ContainerBaseImage=dotnet-bun-base -p:ContainerRepository=${{ env.image_repository_name }} -p:ContainerRegistry=ghcr.io -p:ContainerImageTags=latest -p:ContainerPort=80
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 }}
0 commit comments