Skip to content

Commit

Permalink
chore(automation) : run in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
nielskorporaal committed Oct 2, 2024
1 parent d34ff0b commit 23d1f62
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 5 deletions.
8 changes: 3 additions & 5 deletions .docker/historie-data-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@ version: '3.7'
services:
historie-data-service:
container_name: historie-data-service
image: ghcr.io/brp-api/historie-data-service:2.0.4-latest
image: ghcr.io/brp-api/historie-data-service:latest
environment:
- ASPNETCORE_URLS=http://+;
- Database__Host=postgres
- Database__Username=root
- Database__Password=root
- Database__Database=rvig_haalcentraal_testdata
- HaalcentraalApi__MaxSearchResults=10
- ASPNETCORE_URLS=http://+;
- ProtocolleringAuthorization__UseAuthorizationChecks=false
- ProtocolleringAuthorization__UseProtocollering=false
- Ecs__Path=/var/log/historie-data-service.json
- Ecs__SecuredPath=/var/log/historie-data-service-secured.json
- Ecs__FileSizeLimitBytes=1073741824
- Ecs__RetainedFileCountLimit=10
- Serilog__MinimumLevel__Default=Warning
- Serilog__MinimumLevel__Override__Serilog=Information
# - Ecs__RetainedFileCountLimit=10
ports:
- "8000:80"
volumes:
Expand Down
11 changes: 11 additions & 0 deletions scripts/containers-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

MODE=$1

if [ "$MODE" = "ci" ]; then
# gebruik docker compose up -d om te forceren dat de container image wordt aangemaakt in de lokale registry
docker compose -f .docker/docker-compose-ci.yml up -d
docker compose -f .docker/docker-compose-ci.yml down
else
docker compose -f src/docker-compose.yml build
fi
40 changes: 40 additions & 0 deletions src/Historie.Data.Service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

# This stage is used when running from VS in fast mode (Default for Debug configuration)
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app


# This stage is used to build the service project
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Historie.Data.Service/Historie.Data.Service.csproj", "Historie.Data.Service/"]
COPY ["Rvig.Base.App/Rvig.Base.App.csproj", "Rvig.Base.App/"]
COPY ["Brp.Shared.Infrastructure/Brp.Shared.Infrastructure.csproj", "Brp.Shared.Infrastructure/"]
COPY ["Serilog.Sinks.PersistentFile/Serilog.Sinks.PersistentFile.csproj", "Serilog.Sinks.PersistentFile/"]
COPY ["Rvig.Data.Base.WebApi/Rvig.Data.Base.WebApi.csproj", "Rvig.Data.Base.WebApi/"]
COPY ["Rvig.Data.Base/Rvig.Data.Base.csproj", "Rvig.Data.Base/"]
COPY ["Rvig.HaalCentraalApi.Shared/Rvig.HaalCentraalApi.Shared.csproj", "Rvig.HaalCentraalApi.Shared/"]
COPY ["Rvig.Data.Base.Postgres/Rvig.Data.Base.Postgres.csproj", "Rvig.Data.Base.Postgres/"]
COPY ["Rvig.Data.Historie/Rvig.Data.Historie.csproj", "Rvig.Data.Historieen/"]
COPY ["Rvig.HaalCentraalApi.Historie/Rvig.HaalCentraalApi.Historie.csproj", "Rvig.HaalCentraalApi.Historie/"]
RUN dotnet restore "./Historie.Data.Service/Historie.Data.Service.csproj"
COPY . .
WORKDIR "/src/Historie.Data.Service"
RUN dotnet build "./Historie.Data.Service.csproj" -c "$BUILD_CONFIGURATION" -o /app/build

# This stage is used to publish the service project to be copied to the final stage
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Historie.Data.Service.csproj" -c "$BUILD_CONFIGURATION" -o /app/publish /p:UseAppHost=false

# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .

# See https://github.com/Contrast-Security-OSS/agent-operator/blob/master/docs/public/08-tips.md
ENV DOTNET_HOSTBUILDER__RELOADCONFIGONCHANGE=false

ENTRYPOINT ["dotnet", "Historie.Data.Service.dll"]
7 changes: 7 additions & 0 deletions src/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
historie-data-service:
image: ghcr.io/brp-api/historie-data-service:latest
build:
context: .
dockerfile: Historie.Data.Service/Dockerfile

0 comments on commit 23d1f62

Please sign in to comment.