Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting started with Aspire & Aspirate: No Dockerfile components selected. #250

Open
cataggar opened this issue Aug 12, 2024 · 0 comments
Open

Comments

@cataggar
Copy link

cataggar commented Aug 12, 2024

🔥 Bug Description

I posted this to dotnet/aspire#5260 , but think it probably belongs here. aspirate --version says it is 8.0.7. I'm not sure if I've coded the AppHost wrong or if it's a bug in finding the Dockerfile in the Aspirate code.

I'm just getting started with Aspire & Aspirate. I attempted to use the dotnet new aspire-starter template and then modify the AppHost/Program.cs to add a Docker container.

var builder = DistributedApplication.CreateBuilder(args);

var api = builder
    .AddProject<Projects.Aspir8_ApiService>("api");

builder.AddContainer("apiContainer", "mcr.microsoft.com/dotnet/aspnet:5.0")
    .WithDockerfile(".")
    .WithReference(api);

builder.Build().Run();

But when I run aspirate build, I get the error No Dockerfile components selected. Skipping build and publish action..

Example output:

~/ms/aspire-starter/Aspir8.AppHost> az acr login -n cataggar26acr
Login Succeeded
~/ms/aspire-starter/Aspir8.AppHost> aspirate build --disable-secrets=true

     _                    _           ___  
    / \     ___   _ __   (_)  _ __   ( _ )
   / _ \   / __| | '_ \  | | | '__|  / _ \
  / ___ \  \__ \ | |_) | | | | |    | (_) |
 /_/   \_\ |___/ | .__/  |_| |_|     \___/
                 |_|
Handle deployments of a .NET Aspire AppHost


── Handling Aspirate State ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Loading state from C:\Users\cataggar\ms\aspire-starter\Aspir8.AppHost\aspirate-state.json.
Would you like to use all previous state values, and skip re-prompting where possible ? [y/n] (y): n
(?) Done:  State has been disabled for this run. Only secrets will be populated.

── Handling Aspirate Secrets ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────Secrets are disabled.

── Handling Configuration ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────Successfully loaded existing aspirate bootstrap settings from '.'.

── Handling Aspire Manifest ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────Generating Aspire Manifest for supplied App Host
(?) Done:  Created Aspire Manifest At Path: C:\Users\cataggar\ms\aspire-starter\Aspir8.AppHost\manifest.json

── Selecting Required Components ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

── Gathering Information about deployables ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Gathering container details for each project in selected components
(?) Done:  Populated container details cache for project api
Gathering Tasks Completed - Cache Populated.

── Handling Projects ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Building all project resources, and pushing containers

Executing: dotnet publish "C:\Users\cataggar\ms\aspire-starter\Aspir8.AppHost\../Aspir8.ApiService/Aspir8.ApiService.csproj" -t:PublishContainer --verbosity "quiet" --nologo -r "linux-x64"
-p:ContainerRegistry="cataggar26acr.azurecr.io" -p:ContainerRepository="api" -p:ContainerImageTag="latest"
(?) Done:  Building and Pushing container for project api
Building and push completed for all selected project components.

── Handling Dockerfiles ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
No Dockerfile components selected. Skipping build and publish action.

 ?? Execution Completed ??

🔍 Steps to Reproduce the Bug

I put everything in a GitHub repo to reproduce at https://github.com/cataggar/aspire-starter .

cd Aspir8.AppHost
aspire init
az acr login -n cataggar26acr
aspirate build --disable-secrets=true

🧯 Possible Solution

  1. Code the AppHost correctly, but how?
  2. If it is a bug in Aspirate, fix the bug for finding the Dockerfile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant