Skip to content

Commit

Permalink
Included the new api-gateway inside the docker compose
Browse files Browse the repository at this point in the history
Signed-off-by: Emil Balitzki <emil.balitzki@gmail.com>
  • Loading branch information
Corgam committed Jun 9, 2024
1 parent bc78670 commit 0728855
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 11 deletions.
25 changes: 25 additions & 0 deletions backend/api-gateway/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>api_gateway</RootNamespace>
<RootNamespace>APIGateway</RootNamespace>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions backend/api-gateway/Controllers/APIGatewayController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Text.Json;
using api_gateway.Models;
using APIGateway.Models;
using System.ComponentModel.DataAnnotations;

namespace BIE.Core.API.Controllers
Expand Down Expand Up @@ -49,8 +49,8 @@ public async Task<IActionResult> GetDatasetViewportData(
}

_logger.LogInformation($"Fetching data for DatasetID: {datasetID}, ZoomLevel: {zoomLevel}, Viewport: [{BottomLat}, {BottomLong}] to [{TopLat}, {TopLong}]");

var targetUrl = $"http://localhost:8081/api/v1.0/Dataset/1/data?ZoomLevel={zoomLevel}&BottomLat={BottomLat}&BottomLong={BottomLong}&TopLat={TopLat}&TopLong={TopLong}";
// Here the port 80 is used not 8080. This is due to the docker containers using the interal ports to communicate and not the external ones.
var targetUrl = $"http://api-composer:80/api/v1.0/Dataset/1/data?ZoomLevel={zoomLevel}&BottomLat={BottomLat}&BottomLong={BottomLong}&TopLat={TopLat}&TopLong={TopLong}";

try
{
Expand Down
30 changes: 30 additions & 0 deletions backend/api-gateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Use the official Microsoft .NET SDK image to build the app
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

# Set the working directory inside the container
WORKDIR /app

# Copy the .csproj file and restore any dependencies
COPY *.csproj ./
RUN dotnet restore

# Copy the remaining source code
COPY . ./

# Build the application
RUN dotnet publish -c Release -o out

# Use the official Microsoft .NET runtime image to run the app
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime

# Set the working directory inside the container
WORKDIR /app

# Copy the build output from the build stage
COPY --from=build /app/out .

# Expose the port the application will run on
EXPOSE 8080

# Start the application
ENTRYPOINT ["dotnet", "APIGateway.dll"]
2 changes: 1 addition & 1 deletion backend/api-gateway/Models/GeoJsonResponse.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace api_gateway.Models
namespace APIGateway.Models
{
public class GeoJsonResponse
{
Expand Down
6 changes: 0 additions & 6 deletions backend/api-gateway/api-gateway.http

This file was deleted.

0 comments on commit 0728855

Please sign in to comment.