Files
pos-system/apps/web-client-tpos-net/Dockerfile
Ho Ngoc Hai 6256db44b7 fix(staff): resolve password reset failures and validation issues
- Fix IAM 401: Change reset-password endpoint to [AllowAnonymous]
  (BFF already handles auth, IAM token validation fails across
  Docker container boundaries with Duende IdentityServer)
- Fix IAM 500: Add Npgsql.EnableLegacyTimestampBehavior switch to
  resolve DateTime Kind=Unspecified issue with Identity UserManager
- Fix handler: Use RemovePassword + AddPassword instead of
  ResetPasswordAsync to avoid timestamptz column errors
- Fix validation: Remove mandatory employee code check when editing
  (staff created via IAM may not have employeeCode set)
- Fix Dockerfile: Use root repo context to include blazor-ui package

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 10:55:50 +07:00

75 lines
3.9 KiB
Docker

# ═══════════════════════════════════════════════════════════════════════════════
# WebClientTpos Dockerfile
# EN: Multi-stage build for Blazor WebAssembly Hosted (root context)
# VI: Multi-stage build cho Blazor WebAssembly Hosted (root context)
# ═══════════════════════════════════════════════════════════════════════════════
# ═══════════════════════════════════════════════════════════════════════════════
# Stage 1: Build
# ═══════════════════════════════════════════════════════════════════════════════
FROM mcr.microsoft.com/dotnet/sdk:10.0-alpine AS build
WORKDIR /src
# EN: Copy project files for layer caching (app + shared package)
# VI: Copy project files để cache layers (app + shared package)
COPY apps/web-client-tpos-net/WebClientTpos.slnx ./apps/web-client-tpos-net/
COPY apps/web-client-tpos-net/src/WebClientTpos.Shared/WebClientTpos.Shared.csproj ./apps/web-client-tpos-net/src/WebClientTpos.Shared/
COPY apps/web-client-tpos-net/src/WebClientTpos.Client/WebClientTpos.Client.csproj ./apps/web-client-tpos-net/src/WebClientTpos.Client/
COPY apps/web-client-tpos-net/src/WebClientTpos.Server/WebClientTpos.Server.csproj ./apps/web-client-tpos-net/src/WebClientTpos.Server/
COPY packages/blazor-ui/GoodGo.BlazorUi.csproj ./packages/blazor-ui/
# EN: Restore dependencies
# VI: Restore dependencies
WORKDIR /src/apps/web-client-tpos-net
RUN dotnet restore
# EN: Copy full source code
# VI: Copy toàn bộ source code
WORKDIR /src
COPY apps/web-client-tpos-net/ ./apps/web-client-tpos-net/
COPY packages/blazor-ui/ ./packages/blazor-ui/
# EN: Build and publish
# VI: Build và publish
RUN dotnet publish apps/web-client-tpos-net/src/WebClientTpos.Server/WebClientTpos.Server.csproj \
-c Release \
-o /app/publish
# ═══════════════════════════════════════════════════════════════════════════════
# Stage 2: Runtime
# ═══════════════════════════════════════════════════════════════════════════════
FROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine AS runtime
WORKDIR /app
# EN: Install ICU libs for globalization support (Alpine doesn't include them)
# VI: Cài đặt ICU libs cho hỗ trợ globalization (Alpine không bao gồm sẵn)
RUN apk add --no-cache icu-libs
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
# EN: Create non-root user for security
# VI: Tạo user không phải root để bảo mật
RUN adduser -D -u 1000 appuser && chown -R appuser /app
USER appuser
# EN: Copy published output
# VI: Copy output đã publish
COPY --from=build /app/publish .
# EN: Expose port
# VI: Expose port
EXPOSE 8080
# EN: Health check
# VI: Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
# EN: Set environment variables
# VI: Thiết lập biến môi trường
ENV ASPNETCORE_URLS=http://+:8080
ENV ASPNETCORE_ENVIRONMENT=Production
# EN: Run the application
# VI: Chạy ứng dụng
ENTRYPOINT ["dotnet", "WebClientTpos.Server.dll"]