Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #8 from MindFlavor/docker/pr
Browse files Browse the repository at this point in the history
Multi stage Dockerfile
  • Loading branch information
MindFlavor authored Apr 1, 2019
2 parents 26d21dd + a3fc9df commit 9a13388
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 as build_debug

COPY . /app
WORKDIR /app
RUN dotnet publish -c Debug

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 as debug

WORKDIR /app

COPY --from=build_debug /app/bin/Debug/netcoreapp2.2/publish /app
COPY --from=build_debug /app/Templates /app/Templates

EXPOSE 9966

CMD ["dotnet", "MindFlavor.SQLServerExporter.dll", "-c", "/config/config.json"]

FROM mcr.microsoft.com/dotnet/core/sdk:2.2 as build_release

COPY . /app
WORKDIR /app
RUN dotnet publish -c Release

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 as release

WORKDIR /app

COPY --from=build_release /app/bin/Release/netcoreapp2.2/publish /app
COPY --from=build_release /app/Templates /app/Templates

EXPOSE 9966

CMD ["dotnet", "MindFlavor.SQLServerExporter.dll", "-c", "/config/config.json"]


22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,28 @@ sql_os_schedulers_active_workers_count{instance="FRCOGNOWIN10\SQL17", parent_nod

This makes it possible to do interesting stuff in Grafana using Regexes (for example, you can plot the different worker threads per NUMA node).

## Docker

This is how you use it as container:

```bash
docker run -p 9966:9966 -v /home/mindflavor/:/config mindflavor:prometheus_sql_server_exporter
```

Where the mapped config folder contains the `config.json` file.

To create the container:

```json
docker build --tag=prometheus_sql_server_exporter .
```

In the project root folder. By default the container will use the `release` configuration for `dotnet publish`. If you want a container with the `debug` version of the code simply use:

```bash
docker build --target debug --tag=prometheus_sql_server_exporter .
```

## Contributing

The project needs help! Just fork/open an issue/whatever, no formality is required. Please note, however, that any code you submit as pull request must comply with this project LICENSE.

0 comments on commit 9a13388

Please sign in to comment.