Skip to content

Commit 4c0190c

Browse files
committed
Use custom base image
1 parent 650571d commit 4c0190c

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

.github/workflows/build-container.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
if: ${{ github.event.workflow_run.conclusion == 'success' }}
2525
steps:
2626
- name: Checkout code
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@v4
2828

2929
- name: Set up environment variables
3030
run: |
@@ -87,10 +87,27 @@ jobs:
8787
password: ${{ env.KAMAL_REGISTRY_PASSWORD }}
8888

8989
- name: Setup .NET
90-
uses: actions/setup-dotnet@v3
90+
uses: actions/setup-dotnet@v4
9191
with:
9292
dotnet-version: '8.0'
9393

94+
- name: Set up Docker Buildx
95+
uses: docker/setup-buildx-action@v3
96+
97+
# Build custom base image first
98+
- name: Build custom base image
99+
run: |
100+
cat << 'EOF' > base.Dockerfile
101+
FROM mcr.microsoft.com/dotnet/aspnet:8.0
102+
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/*
107+
EOF
108+
109+
docker build -f base.Dockerfile -t dotnet-bun-base .
110+
94111
- name: Build and push Docker image
95112
run: |
96-
dotnet publish --os linux --arch x64 -c Release -p:ContainerRepository=${{ env.image_repository_name }} -p:ContainerRegistry=ghcr.io -p:ContainerImageTags=latest -p:ContainerPort=80
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

0 commit comments

Comments
 (0)