Skip to content

Commit

Permalink
Adjust settings and supress log file generation inside docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
natenho committed Mar 6, 2021
1 parent f4f77b4 commit 94c2145
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/Mockaco/Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ RUN dotnet publish "Mockaco.csproj" -c Release -o /app/publish

FROM base AS final
ENV DOTNET_USE_POLLING_FILE_WATCHER=true
ENV ASPNETCORE_ENVIRONMENT=Docker
WORKDIR /app
COPY --from=publish /app/publish .
COPY ./src/Mockaco/Mocks/hello.json /app/Mocks/
COPY ./src/Mockaco/Settings /app/Settings
VOLUME /app/Mocks
VOLUME /app/Settings
ENTRYPOINT ["dotnet", "Mockaco.dll", "--path", "Mocks", "--urls", "http://+:5000"]
ENTRYPOINT ["dotnet", "Mockaco.dll"]
2 changes: 1 addition & 1 deletion src/Mockaco/Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Mockaco is an HTTP-based API mock server with fast setup, featuring:
The default image ships with a sample "hello" mock:

```console
$ docker run -it --rm -p 5000:80 natenho/mockaco
$ docker run -it --rm -p 5000:5000 natenho/mockaco
```

Mockaco can be accessed by any HTTP client via `http://localhost:5000`
Expand Down
8 changes: 1 addition & 7 deletions src/Mockaco/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"profiles": {
"Mockaco": {
"commandName": "Project",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000"
},
"Docker": {
"commandName": "Docker",
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api/values",
"environmentVariables": {},
"httpPort": 63715
}
}
}
16 changes: 15 additions & 1 deletion src/Mockaco/Settings/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,19 @@
"TemplateFileProvider": {
"Path": "Mocks"
}
}
},
"Serilog": {
"WriteTo": [
{
},
{
"Name": "File",
"Args": {
"path": "Logs/Mockaco_.log",
"rollingInterval": "Day",
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {RequestId} {Message:lj}{NewLine}{Exception}"
}
}
]
}
}
8 changes: 8 additions & 0 deletions src/Mockaco/Settings/appsettings.Docker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Urls": "http://+:5000",
"Mockaco": {
"TemplateFileProvider": {
"Path": "Mocks"
}
}
}
16 changes: 15 additions & 1 deletion src/Mockaco/Settings/appsettings.Production.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
{
"Urls": "http://127.0.0.1:0"
"Urls": "http://127.0.0.1:0",
"Serilog": {
"WriteTo": [
{
},
{
"Name": "File",
"Args": {
"path": "Logs/Mockaco_.log",
"rollingInterval": "Day",
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {RequestId} {Message:lj}{NewLine}{Exception}"
}
}
]
}
}
8 changes: 0 additions & 8 deletions src/Mockaco/Settings/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "Logs/Mockaco_.log",
"rollingInterval": "Day",
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {RequestId} {Message:lj}{NewLine}{Exception}"
}
},
{
"Name": "Console",
"Args": {
Expand Down

0 comments on commit 94c2145

Please sign in to comment.