Skip to content

Commit 0e809ca

Browse files
committed
Prepare infra for deploy
1 parent a6a8101 commit 0e809ca

6 files changed

+67
-80
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea
2+
.sonarqube
23
[oO]bj
34
[bB]in

Dockerfile

+11-18
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
1-
# STAGE 1: Build Environment
2-
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build-env
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build-env
32
WORKDIR /src
43

54
ARG NUGET_API_KEY
65

7-
# Copy the project files first for better layer caching (if only code changes)
86
COPY . ./
97

10-
# Add the custom NuGet source
11-
RUN dotnet nuget add source https://nuget.pkg.github.com/trumpee/index.json --name github --username trumpee --password $NUGET_API_KEY --store-password-in-clear-text
8+
RUN dotnet nuget add source https://nuget.pkg.github.com/trumpee/index.json \
9+
--name github \
10+
--username trumpee \
11+
--password $NUGET_API_KEY \
12+
--store-password-in-clear-text
1213

13-
# Restore NuGet packages from both sources
14-
RUN dotnet restore Gateway.sln --source "https://api.nuget.org/v3/index.json" --source "https://nuget.pkg.github.com/trumpee/index.json"
14+
RUN dotnet restore Gateway.sln \
15+
--source "https://api.nuget.org/v3/index.json" \
16+
--source "https://nuget.pkg.github.com/trumpee/index.json"
1517

16-
# Build the solution
17-
RUN dotnet build Gateway.sln -c Release
18+
RUN dotnet build Gateway.sln -c Debug
19+
RUN dotnet publish ./src/Api/Api.csproj -c Debug -o /app
1820

19-
# Publish the Api project only (assuming this is the main entry point)
20-
RUN dotnet publish ./src/Api/Api.csproj -c Release -o /app
21-
22-
# STAGE 2: Runtime Environment
2321
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
2422
WORKDIR /app
2523
COPY --from=build-env /app .
26-
27-
# Expose the port your application listens on (replace 80 if needed)
28-
EXPOSE 80
29-
30-
# Define the entry point for your application
3124
ENTRYPOINT ["dotnet", "Api.dll"]

docker-compose.yml

-29
This file was deleted.

infra-only-docker-compose.yml

-28
This file was deleted.

sonarqube-docker-compose.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
version: "3"
2+
services:
3+
sonarqube:
4+
image: sonarqube:community
5+
container_name: sonarqube
6+
depends_on:
7+
- db
8+
environment:
9+
SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
10+
SONAR_JDBC_USERNAME: sonar
11+
SONAR_JDBC_PASSWORD: sonar
12+
volumes:
13+
- sonarqube_data:/opt/sonarqube/data
14+
- sonarqube_extensions:/opt/sonarqube/extensions
15+
- sonarqube_logs:/opt/sonarqube/logs
16+
ports:
17+
- "9000:9000"
18+
db:
19+
image: postgres:13
20+
hostname: postgresql
21+
container_name: postgresql
22+
environment:
23+
POSTGRES_USER: sonar
24+
POSTGRES_PASSWORD: sonar
25+
POSTGRES_DB: sonar
26+
volumes:
27+
- postgresql:/var/lib/postgresql
28+
- postgresql_data:/var/lib/postgresql/data
29+
30+
sonar-scanner:
31+
container_name: sonar-scanner
32+
image: newtmitch/sonar-scanner
33+
networks:
34+
- sonarnet
35+
volumes:
36+
- ./:/usr/src
37+
depends_on:
38+
- sonarqube
39+
40+
networks:
41+
sonarnet:
42+
43+
volumes:
44+
sonarqube_conf:
45+
sonarqube_data:
46+
sonarqube_logs:
47+
sonarqube_extensions:
48+
sonarqube_bundled-plugins:
49+
postgresql:
50+
postgresql_data:

src/Api/appsettings.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
22
"Logging": {
33
"LogLevel": {
4-
"Default": "Error",
5-
"Microsoft.AspNetCore": "Error",
4+
"Default": "Trace",
5+
"Microsoft.AspNetCore": "Trace",
66
"Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware": "None"
77
}
88
},
99
"AllowedHosts": "*",
1010
"MongoDb": {
1111
"DatabaseName": "trumpee",
12-
"ConnectionString": "mongodb://root:password@localhost:23001/"
12+
"ConnectionString": "mongodb://root:password@trumpee_mongodb:27017/"
1313
},
1414
"MassTransit": {
1515
"Transport": {
16-
"Host": "127.0.0.1",
16+
"Host": "trumpee_rabbitmq",
1717
"VHost": "/",
1818
"Username": "guest",
1919
"Password": "guest",
20-
"Port": 23501
20+
"Port": 5672
2121
}
2222
}
2323
}

0 commit comments

Comments
 (0)