Skip to content

Commit

Permalink
Fix doc issue, fix the docker context of a Spring project.
Browse files Browse the repository at this point in the history
  • Loading branch information
saragluna committed Jul 3, 2024
1 parent 1533bdd commit 1d431a2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ build/
**/.mvn/
/temp/*
**/output/**

.azure
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import com.microsoft.aspire.resources.traits.IntrospectiveResource;
import jakarta.validation.Valid;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Set;

public class SpringProject extends Project<SpringProject> implements IntrospectiveResource {
Expand Down Expand Up @@ -43,9 +45,11 @@ public void introspect() {
// context name (which is the directory containing the Dockerfile)
DockerFile<?> dockerFile = new DockerFile<>(getName());

String dockerFilePath = s.getCommands().get(0);
Path contextPath = Paths.get(dockerFilePath).getParent();
this.copyInto(dockerFile);
dockerFile.withPath(s.getCommands().get(0))
.withContext(getName())
dockerFile.withPath(dockerFilePath)
.withContext(contextPath.toString())
.withExternalHttpEndpoints(); // FIXME this is not really the context

DistributedApplication.getInstance().substituteResource(this, dockerFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public interface AppHost {
/**
* This is the primary front door through which users interact with the apphost. It can be called directly from
* the main method of your AppHost implementation. It will parse the runtime arguments and determine the mode of
* operation, and the proceed to execute the appropriate method.
* operation, and then proceed to execute the appropriate method.
*
* @param args An array of runtime arguments received when the application first starts.
*/
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This GitHub repository is split into many sub-projects, but they can be broadly
* **Aspire4J**:
* `aspire4j`: The core library that provides the AppHost and the ability to define infrastructure as code.
* `aspire4j-extensions-*`: Extensions for the Aspire4J library, providing support for Azure, Spring, etc.
* `aspire4j-maven-archetype`: A Maven archetype that can be used to create new Aspire4J App Hosts.
* `aspire4j-maven-tools`: A Maven archetype that can be used to create new Aspire4J App Hosts.
* **Sample Applications**:
* **Storage Explorer**: Refer to the [readme](tree/main/samples/storage-explorer/readme.md) for more information.

Expand All @@ -31,13 +31,13 @@ Feedback is welcome!
If you want to use Aspire4J in your Java microservice projects, you can! Here's how you can create your own Aspire App Host:

1. Clone this repository onto your machine.
2. From the root of the repository, run `mvn -f aspire4j-maven-archetype clean install`.
2. From the root of the repository, run `mvn -f aspire4j/aspire4j-maven-tools clean install`.
3. Go to your existing Java project and run the following:

```shell
mvn archetype:generate \
-DarchetypeGroupId=com.microsoft.aspire \
-DarchetypeArtifactId=aspire4j-maven-archetype \
-DarchetypeArtifactId=aspire4j-maven-tools \
-DarchetypeVersion=1.0-SNAPSHOT
```

Expand Down

0 comments on commit 1d431a2

Please sign in to comment.