diff --git a/MoneyMap/.dockerignore b/MoneyMap/.dockerignore new file mode 100644 index 0000000..6fd8373 --- /dev/null +++ b/MoneyMap/.dockerignore @@ -0,0 +1,7 @@ +bin/ +obj/ +.vs/ +*.user +*.suo +appsettings.Development.json +wwwroot/receipts/ diff --git a/MoneyMap/Dockerfile b/MoneyMap/Dockerfile new file mode 100644 index 0000000..216b247 --- /dev/null +++ b/MoneyMap/Dockerfile @@ -0,0 +1,35 @@ +# Build stage +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +WORKDIR /src + +# Copy csproj and restore dependencies +COPY MoneyMap.csproj . +RUN dotnet restore + +# Copy everything else and build +COPY . . +RUN dotnet publish -c Release -o /app/publish + +# Runtime stage +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime +WORKDIR /app + +# Install ImageMagick dependencies for Magick.NET +RUN apt-get update && apt-get install -y \ + libmagickwand-dev \ + && rm -rf /var/lib/apt/lists/* + +# Copy published app +COPY --from=build /app/publish . + +# Create directory for receipts +RUN mkdir -p /app/receipts + +# Expose port +EXPOSE 5010 + +# Set environment variables +ENV ASPNETCORE_URLS=http://+:5010 +ENV ASPNETCORE_ENVIRONMENT=Production + +ENTRYPOINT ["dotnet", "MoneyMap.dll"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..88cad6c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +services: + moneymap: + build: + context: ./MoneyMap + dockerfile: Dockerfile + container_name: moneymap + ports: + - "5010:5010" + environment: + - ConnectionStrings__MoneyMapDb=Server=barge.lan;Database=MoneyMap;User Id=moneymap;Password=YOUR_PASSWORD;TrustServerCertificate=True; + - Receipts__StoragePath=/app/receipts + - OPENAI_API_KEY=${OPENAI_API_KEY} + volumes: + - /mnt/docker-data/moneymap/receipts:/app/receipts + restart: unless-stopped