Gives the company tables of the previous commit their screens, so a company can be configured from the browser, and makes the base data runnable outside the web server. - one generic editor for the 26 coded tables (/tabelle/<slug>), described in TableScreens: grid with active/disabled filter, detail with errors and warnings, disable instead of delete, CSV export and all-or-nothing import, "update from base tables"; index page and menu entries - company profile in tabs with the fiscal pack checks, fiscal years with month lock/unlock, exchange rates with manual rates - PaymentTermService: installments saved together, percentages must sum to 100 - a new profile proposes the registered company name instead of its code - seed verb in Khaemhat.Web and scripts/seed.sh --base [--company CODE], shipped in the image under /app/scripts - ADR 0026 (base data only adds missing codes; ISTAT and ABI/CAB lists come as separate datasets), wiki, CHANGELOG, STATUS Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
91 lines
4.6 KiB
Docker
91 lines
4.6 KiB
Docker
# syntax=docker/dockerfile:1
|
|
# Khaemhat image (SPEC §16.1, ADR 0009, 0010, 0013, 0015, 0016, 0017). Build from the repository root:
|
|
# docker build -f docker/Dockerfile --build-arg VERSION=0.0.1 --build-arg GIT_SHA=$(git rev-parse --short HEAD) .
|
|
|
|
ARG DOTNET_VERSION=10.0
|
|
|
|
# ---------------------------------------------------------------------------------------------------------------------
|
|
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS build
|
|
ARG VERSION=0.0.0-dev
|
|
ARG GIT_SHA=unknown
|
|
ARG RUN_TESTS=false
|
|
ENV DOTNET_NOLOGO=1 DOTNET_CLI_TELEMETRY_OPTOUT=1 DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
|
WORKDIR /src
|
|
|
|
# Restore first, from the build files only, so the layer is reused while no project or package changes.
|
|
COPY global.json Directory.Build.props Directory.Build.targets Directory.Packages.props .editorconfig ./
|
|
COPY src/Khaemhat.Core/Khaemhat.Core.csproj src/Khaemhat.Core/
|
|
COPY src/Khaemhat.Fiscal.Abstractions/Khaemhat.Fiscal.Abstractions.csproj src/Khaemhat.Fiscal.Abstractions/
|
|
COPY src/Khaemhat.Fiscal.Italy/Khaemhat.Fiscal.Italy.csproj src/Khaemhat.Fiscal.Italy/
|
|
COPY src/Khaemhat.Data/Khaemhat.Data.csproj src/Khaemhat.Data/
|
|
COPY src/Khaemhat.Data.Sqlite/Khaemhat.Data.Sqlite.csproj src/Khaemhat.Data.Sqlite/
|
|
COPY src/Khaemhat.Data.PostgreSql/Khaemhat.Data.PostgreSql.csproj src/Khaemhat.Data.PostgreSql/
|
|
COPY src/Khaemhat.Infrastructure/Khaemhat.Infrastructure.csproj src/Khaemhat.Infrastructure/
|
|
COPY src/Khaemhat.Application/Khaemhat.Application.csproj src/Khaemhat.Application/
|
|
COPY src/Khaemhat.Web/Khaemhat.Web.csproj src/Khaemhat.Web/
|
|
RUN dotnet restore src/Khaemhat.Web/Khaemhat.Web.csproj
|
|
|
|
COPY . .
|
|
RUN bash scripts/check-packages.sh
|
|
RUN if [ "$RUN_TESTS" = "true" ]; then \
|
|
dotnet test Khaemhat.sln -c Release /p:Version="$VERSION" /p:SourceRevisionId="$GIT_SHA"; \
|
|
fi
|
|
RUN dotnet publish src/Khaemhat.Web/Khaemhat.Web.csproj -c Release -o /app --no-restore \
|
|
/p:Version="$VERSION" /p:SourceRevisionId="$GIT_SHA" /p:UseAppHost=false
|
|
|
|
# ---------------------------------------------------------------------------------------------------------------------
|
|
FROM mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION} AS runtime
|
|
ARG VERSION=0.0.0-dev
|
|
ARG GIT_SHA=unknown
|
|
ARG CREATED=unknown
|
|
ARG SOURCE_URL=https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat
|
|
ARG ICON_URL=https://gitea.encke-hake.ts.net/BalboSoft/Khaemhat/raw/branch/main/assets/icon-256.png
|
|
|
|
# OS tools allowed by SPEC §1.2 (not application components): pg_dump/pg_restore 17 from the PGDG repository (a
|
|
# client >= the server: works with PostgreSQL 16 and 17), curl for the health check, tzdata for TZ.
|
|
RUN set -eux; \
|
|
apt-get update; \
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl tzdata; \
|
|
. /etc/os-release; \
|
|
install -d /usr/share/postgresql-common/pgdg; \
|
|
curl -fsSL -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc https://www.postgresql.org/media/keys/ACCC4CF8.asc; \
|
|
echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt ${VERSION_CODENAME}-pgdg main" \
|
|
> /etc/apt/sources.list.d/pgdg.list; \
|
|
apt-get update; \
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends postgresql-client-17; \
|
|
rm -rf /var/lib/apt/lists/*; \
|
|
pg_dump --version
|
|
|
|
ENV ASPNETCORE_ENVIRONMENT=Production \
|
|
ASPNETCORE_HTTP_PORTS=8080 \
|
|
KHAEMHAT_DATA_DIR=/data \
|
|
DOTNET_NOLOGO=1 \
|
|
TZ=Europe/Rome
|
|
|
|
WORKDIR /app
|
|
COPY --from=build /app ./
|
|
COPY docker/entrypoint.sh /app/entrypoint.sh
|
|
COPY scripts/restore-system.sh scripts/seed.sh /app/scripts/
|
|
RUN chmod 0755 /app/entrypoint.sh /app/scripts/restore-system.sh /app/scripts/seed.sh \
|
|
&& install -d -o app -g app -m 0750 /data
|
|
|
|
LABEL org.opencontainers.image.title="Khaemhat" \
|
|
org.opencontainers.image.description="Gestionale ERP e CRM per PMI italiane" \
|
|
org.opencontainers.image.vendor="BalboSoft" \
|
|
org.opencontainers.image.version="${VERSION}" \
|
|
org.opencontainers.image.revision="${GIT_SHA}" \
|
|
org.opencontainers.image.created="${CREATED}" \
|
|
org.opencontainers.image.source="${SOURCE_URL}" \
|
|
org.opencontainers.image.url="${SOURCE_URL}" \
|
|
org.opencontainers.image.documentation="${SOURCE_URL}/wiki" \
|
|
net.unraid.docker.icon="${ICON_URL}" \
|
|
net.unraid.docker.webui="http://[IP]:[PORT:8080]/"
|
|
|
|
VOLUME /data
|
|
EXPOSE 8080
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
|
CMD curl -fs http://localhost:8080/health/live || exit 1
|
|
|
|
# Starts as root only to align the app user with PUID/PGID; the .NET process runs as "app" (ADR 0013).
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|