littleshop/Dockerfile.deploy
SysAdmin 8b0e3e0611 Implement comprehensive notification system for LittleShop
- Add admin PWA push notifications for order management
- Integrate TeleBot customer messaging service
- Add push notification endpoints and VAPID key support
- Implement order status notifications throughout workflow
- Add notification UI components in admin panel
- Create TeleBotMessagingService for customer updates
- Add WebPush configuration to appsettings
- Fix compilation issues (BotStatus, BotContacts DbSet)
- Add comprehensive testing documentation

Features:
- Real-time admin notifications for new orders and status changes
- Customer order progress updates via TeleBot
- Graceful failure handling for notification services
- Test endpoints for notification system validation

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-19 16:17:24 +01:00

81 lines
2.1 KiB
Docker

# Use the official ASP.NET Core runtime image (optimized)
FROM mcr.microsoft.com/dotnet/aspnet:9.0-jammy-chiseled AS base
WORKDIR /app
EXPOSE 8080
# Create non-root user for security
USER $APP_UID
# Use the SDK image for building
FROM mcr.microsoft.com/dotnet/sdk:9.0-jammy AS build
WORKDIR /src
# Copy project files first for better layer caching
COPY ["LittleShop/LittleShop.csproj", "LittleShop/"]
COPY ["LittleShop.Client/LittleShop.Client.csproj", "LittleShop.Client/"]
# Restore packages in a separate layer
RUN dotnet restore "LittleShop/LittleShop.csproj" \
--runtime linux-x64 \
--no-cache \
--verbosity minimal
# Copy source code
COPY LittleShop/ LittleShop/
COPY LittleShop.Client/ LittleShop.Client/
WORKDIR "/src/LittleShop"
# Build with optimizations
RUN dotnet build "LittleShop.csproj" \
-c Release \
-o /app/build \
--no-restore \
--verbosity minimal
# Publish stage with optimizations
FROM build AS publish
RUN dotnet publish "LittleShop.csproj" \
-c Release \
-o /app/publish \
--no-restore \
--no-build \
--runtime linux-x64 \
--self-contained false \
/p:PublishTrimmed=false \
/p:PublishSingleFile=false \
/p:DebugType=None \
/p:DebugSymbols=false
# Final optimized stage
FROM base AS final
WORKDIR /app
# Switch to root to create directories and set permissions
USER root
# Create directories with proper ownership
RUN mkdir -p /app/wwwroot/uploads/products \
&& mkdir -p /app/data \
&& mkdir -p /app/logs \
&& chown -R $APP_UID:$APP_UID /app \
&& chmod -R 755 /app/wwwroot/uploads \
&& chmod -R 755 /app/data \
&& chmod -R 755 /app/logs
# Copy published app
COPY --from=publish --chown=$APP_UID:$APP_UID /app/publish .
# Switch back to non-root user
USER $APP_UID
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Optimize runtime
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 \
DOTNET_RUNNING_IN_CONTAINER=true \
DOTNET_USE_POLLING_FILE_WATCHER=true \
ASPNETCORE_FORWARDEDHEADERS_ENABLED=true
ENTRYPOINT ["dotnet", "LittleShop.dll"]