Chore: Add Docker containerization support

- Add Dockerfile with multi-stage build for .NET 8
- Include ImageMagick dependencies for Magick.NET
- Add docker-compose.yml with volume mount for receipts
- Add .dockerignore to exclude build artifacts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-03 22:01:03 -05:00
parent 3a817e0f3f
commit 101a340d8c
3 changed files with 57 additions and 0 deletions

7
MoneyMap/.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
bin/
obj/
.vs/
*.user
*.suo
appsettings.Development.json
wwwroot/receipts/

35
MoneyMap/Dockerfile Normal file
View File

@@ -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"]

15
docker-compose.yml Normal file
View File

@@ -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