littleshop/Dockerfile
SysAdmin 86f19ba044
All checks were successful
Build and Deploy LittleShop / Deploy to Pre-Production (CT109) (push) Successful in 59s
Build and Deploy LittleShop / Deploy to Production VPS (Manual Only) (push) Has been skipped
feat: Add AlexHost deployment pipeline and bot control functionality
- Add Gitea Actions workflow for manual AlexHost deployment
- Add docker-compose.alexhost.yml for production deployment
- Add deploy-alexhost.sh script with server-side build support
- Add Bot Control feature (Start/Stop/Restart) for remote bot management
- Add discovery control endpoint in TeleBot
- Update TeleBot with StartPollingAsync/StopPolling/RestartPollingAsync
- Fix platform architecture issues by building on target server
- Update docker-compose configurations for all environments

Deployment tested successfully:
- TeleShop: healthy at https://teleshop.silentmary.mywire.org
- TeleBot: healthy with discovery integration
- SilverPay: connectivity verified

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 12:33:46 +00:00

85 lines
2.4 KiB
Docker

# Use the official ASP.NET Core runtime image (optimized)
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
EXPOSE 8080
# Install curl for health checks
RUN apt-get update && \
apt-get install -y curl && \
rm -rf /var/lib/apt/lists/*
# Use the SDK image for building
FROM mcr.microsoft.com/dotnet/sdk:9.0 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 \
--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
# Create necessary directories with proper permissions
RUN mkdir -p /app/wwwroot/uploads/products \
&& mkdir -p /app/data \
&& mkdir -p /app/logs \
&& chmod -R 777 /app/wwwroot \
&& chmod -R 777 /app/data \
&& chmod -R 777 /app/logs
# Copy published app
COPY --from=publish /app/publish .
# Health check (disabled for now to avoid startup issues)
# HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
# CMD curl -f http://localhost:8080/health || exit 1
# Set environment variables for production
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=0 \
DOTNET_RUNNING_IN_CONTAINER=true \
DOTNET_USE_POLLING_FILE_WATCHER=true \
ASPNETCORE_FORWARDEDHEADERS_ENABLED=true \
ASPNETCORE_URLS=http://+:8080 \
ASPNETCORE_ENVIRONMENT=Production \
ConnectionStrings__DefaultConnection="Data Source=/app/data/littleshop-production.db;Cache=Shared" \
SilverPay__BaseUrl="http://31.97.57.205:8001" \
SilverPay__ApiKey="your-api-key-here" \
TMPDIR=/tmp
# Start as root to ensure permissions (can be improved later)
USER root
ENTRYPOINT ["dotnet", "LittleShop.dll"]