The name of the Docker Compose environment.
Now we've created a new Spring Boot project, let's run the user interface.
Docker Compose
To run the UI we'll use Docker Compose. This way we can run the UI Docker image with all the configuration it needs to communicate with our Spring Boot app.
You need Docker installed on your machine to run the UI. Once installed you can run the UI from a single file.
If you haven't installed Docker yet, you can find information on how to do this on the Docker website.
To get started, let's create a file named docker-compose.yml in the root of our
project. Then we'll place the following content into the file:
# The name of the Docker Compose environment.
name: devtiro-build-task-app
services:
# The UI service.
ui:
# The UI Docker image, hosted on GitHub.
image: ghcr.io/devtiro/devtiro-build-task-app:latest
ports:
# Make the UI available on http://localhost:3000
- '3000:3000'
# Tell the UI how to find your Spring Boot app.
environment:
- BACKEND_HOST=host.docker.internal
- BACKEND_PORT=8080
# For Linux compatibility
extra_hosts:
- 'host.docker.internal:host-gateway'Run the User Interface
To run the UI, open up a terminal or command prompt and navigate to the same
directory as your docker-compose.yml file.
Once you're there, run the following:
docker-compose upWith that done, head over to http://localhost:3000 in your browser to see
the UI!
Now that we have everything ready to start developing, let's implement our app's domain.
Summary
- Created a
docker-compose.ymlfile. - Ran the UI.