Skip to content

Commit ae3ae9e

Browse files
Use docker version of config when building docker images
1 parent d1c8fde commit ae3ae9e

File tree

9 files changed

+60
-4
lines changed

9 files changed

+60
-4
lines changed

API/OCM.Net/OCM.API.Web/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ ENV ASPNETCORE_URLS="http://+:8080" \
2222
# Copy published output
2323
COPY --from=build /app/publish ./
2424

25+
# Copy Docker-specific configuration files to replace defaults
26+
COPY API/OCM.Net/OCM.API.Web/App.docker.config ./App.Config
27+
COPY API/OCM.Net/OCM.API.Web/appsettings.docker.json ./appsettings.json
28+
2529
# Create non-root user (compatible with Debian-based images)
2630
RUN groupadd -r appuser && useradd -r -g appuser appuser \
2731
&& chown -R appuser:appuser /app
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Debug",
5+
"System": "Information",
6+
"Microsoft": "Information"
7+
}
8+
}
9+
}

API/OCM.Net/OCM.API.Web/appsettings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
},
99
"AllowedHosts": "*",
1010
"CoreSettings": {
11-
"CachePath": "C:\\Temp\\OCM\\",
11+
"CachePath": "/tmp",
1212
"EnableDataWrites": "true",
13+
"IsCacheOnlyMode": "false",
14+
"RefreshCacheOnLoad": "true",
1315
"MongoDBSettings": {
1416
"ConnectionString": "mongodb://localhost:27017",
1517
"DatabaseName": "ocm_mirror",
@@ -19,7 +21,7 @@
1921
"MapQuestOpenAPIKey": "Mapquest Key",
2022
"OsmAPIKey": "OSM Key"
2123
},
22-
"GeolocationShapefilePath": "Shapefiles\\World"
24+
"GeolocationShapefilePath": "Shapefiles/World"
2325
}
2426

2527
}

Website/OCM.Web/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ ENV DOTNET_RUNNING_IN_CONTAINER=true
2424
# Copy published output from build stage
2525
COPY --from=build /app/publish ./
2626

27+
# Copy Docker-specific configuration files to replace defaults
28+
COPY Website/OCM.Web/App.docker.config ./App.Config
29+
COPY Website/OCM.Web/appsettings.docker.json ./appsettings.json
30+
2731
# Create a non-root user and give ownership of the app folder
2832
RUN groupadd -r appuser && useradd -r -g appuser appuser \
2933
&& chown -R appuser:appuser /app

Website/OCM.Web/OCM.Web.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
</ItemGroup>
3737

3838
<ItemGroup>
39+
<Content Update="App.docker.config">
40+
<TransformOnBuild>true</TransformOnBuild>
41+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
42+
</Content>
3943
<Content Update="App.config">
4044
<TransformOnBuild>true</TransformOnBuild>
4145
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Debug",
5+
"System": "Information",
6+
"Microsoft": "Information"
7+
}
8+
}
9+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
},
9+
"AllowedHosts": "*",
10+
"CoreSettings": {
11+
"CachePath": "/tmp",
12+
"EnableDataWrites": "true",
13+
"MongoDBSettings": {
14+
"ConnectionString": "mongodb://mongodb:27017",
15+
"DatabaseName": "ocm_mirror",
16+
"MaxCacheAgeMinutes": "1000"
17+
},
18+
"APIKeys": {
19+
"MapQuestOpenAPIKey": "Mapquest Key",
20+
"OsmAPIKey": "OSM Key"
21+
}
22+
}
23+
24+
}

Website/OCM.Web/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"AllowedHosts": "*",
1010
"CoreSettings": {
11-
"CachePath": "C:\\Temp\\OCM\\",
11+
"CachePath": "/tmp",
1212
"EnableDataWrites": "true",
1313
"MongoDBSettings": {
1414
"ConnectionString": "mongodb://localhost:27017",

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ services:
3939
image: mongodb/mongodb-community-server:latest # Or a specific version like 6.0
4040
container_name: mongodb
4141
ports:
42-
- "27018:27017" # Map host port 27017 to container port 27017
42+
- "27017:27017" # Map host port 27017 to container port 27017
4343
volumes:
4444
- mongodb_data:/data/db # Persist data outside the container
4545
restart: unless-stopped # Restart the container unless manually stopped

0 commit comments

Comments
 (0)