Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b1f83aa7ab | |||
| 20ca84e4f7 | |||
| 91704eb944 | |||
| 3abfed91e1 | |||
| 9d146d521e | |||
| 2e25b451c9 | |||
| 201a15de1f |
@@ -1,6 +1,10 @@
|
|||||||
# Created by https://www.toptal.com/developers/gitignore/api/csharp,visualstudiocode,visualstudio
|
# Created by https://www.toptal.com/developers/gitignore/api/csharp,visualstudiocode,visualstudio
|
||||||
# Edit at https://www.toptal.com/developers/gitignore?templates=csharp,visualstudiocode,visualstudio
|
# Edit at https://www.toptal.com/developers/gitignore?templates=csharp,visualstudiocode,visualstudio
|
||||||
|
|
||||||
|
# Data-Coupler specific
|
||||||
|
# Version file generato automaticamente durante il build
|
||||||
|
Data_Coupler/wwwroot/version.json
|
||||||
|
|
||||||
### Csharp ###
|
### Csharp ###
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
|
||||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.5" />
|
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.5" />
|
||||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.3" />
|
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.3" />
|
||||||
|
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.10" />
|
||||||
<PackageReference Include="System.Data.Odbc" Version="9.0.3" />
|
<PackageReference Include="System.Data.Odbc" Version="9.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -42,4 +42,49 @@
|
|||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Target per generare automaticamente version.json prima del build -->
|
||||||
|
<!-- SOLO per sviluppo locale, NON in CI/CD (il workflow lo genera prima del Docker build) -->
|
||||||
|
<Target Name="GenerateVersionJson" BeforeTargets="BeforeBuild;BeforeRebuild"
|
||||||
|
Condition="'$(ContinuousIntegrationBuild)' != 'true' AND '$(SkipVersionGeneration)' != 'true'">
|
||||||
|
<!-- Esegui git per ottenere il tag più recente e informazioni commit -->
|
||||||
|
<Exec Command="git describe --tags --abbrev=0 2>nul" ConsoleToMSBuild="true" IgnoreExitCode="true">
|
||||||
|
<Output TaskParameter="ConsoleOutput" PropertyName="GitLatestTag" />
|
||||||
|
</Exec>
|
||||||
|
<Exec Command="git rev-parse --short HEAD" ConsoleToMSBuild="true" IgnoreExitCode="true">
|
||||||
|
<Output TaskParameter="ConsoleOutput" PropertyName="GitCommitSha" />
|
||||||
|
</Exec>
|
||||||
|
<Exec Command="git rev-parse --abbrev-ref HEAD" ConsoleToMSBuild="true" IgnoreExitCode="true">
|
||||||
|
<Output TaskParameter="ConsoleOutput" PropertyName="GitBranch" />
|
||||||
|
</Exec>
|
||||||
|
|
||||||
|
<!-- Estrai la versione dal tag (rimuovi il prefisso 'v') -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<ActualVersion Condition="'$(GitLatestTag)' != '' and $(GitLatestTag.StartsWith('v'))">$(GitLatestTag.Substring(1))</ActualVersion>
|
||||||
|
<ActualVersion Condition="'$(GitLatestTag)' != '' and !$(GitLatestTag.StartsWith('v'))">$(GitLatestTag)</ActualVersion>
|
||||||
|
<ActualVersion Condition="'$(GitLatestTag)' == ''">1.0.0-dev</ActualVersion>
|
||||||
|
<ActualCommitSha Condition="'$(GitCommitSha)' != ''">$(GitCommitSha)</ActualCommitSha>
|
||||||
|
<ActualCommitSha Condition="'$(GitCommitSha)' == ''">unknown</ActualCommitSha>
|
||||||
|
<ActualBranch Condition="'$(GitBranch)' != ''">$(GitBranch)</ActualBranch>
|
||||||
|
<ActualBranch Condition="'$(GitBranch)' == ''">local</ActualBranch>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Genera il contenuto JSON -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<FinalVersionJsonContent>
|
||||||
|
{
|
||||||
|
"version": "$(ActualVersion)",
|
||||||
|
"commitSha": "$(ActualCommitSha)",
|
||||||
|
"branch": "$(ActualBranch)",
|
||||||
|
"buildDate": "$([System.DateTime]::Now.ToString('yyyy-MM-dd HH:mm:ss'))",
|
||||||
|
"buildEnvironment": "Development"
|
||||||
|
}
|
||||||
|
</FinalVersionJsonContent>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Scrivi il file version.json -->
|
||||||
|
<WriteLinesToFile File="wwwroot\version.json" Lines="$(FinalVersionJsonContent)" Overwrite="true" />
|
||||||
|
|
||||||
|
<Message Text="Generated version.json with version $(ActualVersion) from git tag (local dev build)" Importance="high" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "2.2.0",
|
|
||||||
"commitSha": "01f7846",
|
|
||||||
"branch": "development",
|
|
||||||
"buildDate": "2026-02-02",
|
|
||||||
"buildEnvironment": "Local"
|
|
||||||
}
|
|
||||||
+12
-8
@@ -20,24 +20,28 @@ COPY . .
|
|||||||
|
|
||||||
# Build del progetto principale
|
# Build del progetto principale
|
||||||
WORKDIR "/src/Data_Coupler"
|
WORKDIR "/src/Data_Coupler"
|
||||||
RUN dotnet build "Data_Coupler.csproj" -c Release -o /app/build
|
RUN dotnet build "Data_Coupler.csproj" -c Release -o /app/build /p:ContinuousIntegrationBuild=true
|
||||||
|
|
||||||
# Stage 2: Publish
|
# Stage 2: Publish
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
RUN dotnet publish "Data_Coupler.csproj" -c Release -o /app/publish \
|
RUN dotnet publish "Data_Coupler.csproj" -c Release -o /app/publish \
|
||||||
/p:UseAppHost=false \
|
/p:SelfContained=false \
|
||||||
/p:PublishTrimmed=false \
|
/p:PublishTrimmed=false \
|
||||||
/p:PublishSingleFile=false
|
/p:PublishSingleFile=false \
|
||||||
|
/p:ContinuousIntegrationBuild=true
|
||||||
|
|
||||||
# Stage 3: Runtime
|
# Stage 3: Runtime
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine AS final
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Installa le dipendenze necessarie per ExcelDataReader e altre librerie
|
# Installa le dipendenze necessarie per ExcelDataReader e SQLite
|
||||||
RUN apk add --no-cache \
|
RUN apt-get update && apt-get install -y \
|
||||||
libgdiplus \
|
libgdiplus \
|
||||||
icu-libs \
|
libc6-dev \
|
||||||
&& rm -rf /var/cache/apk/*
|
sqlite3 \
|
||||||
|
libsqlite3-dev \
|
||||||
|
curl \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Crea la directory per il database con i permessi corretti
|
# Crea la directory per il database con i permessi corretti
|
||||||
RUN mkdir -p /var/lib/Data_Coupler && \
|
RUN mkdir -p /var/lib/Data_Coupler && \
|
||||||
|
|||||||
+2
-2
@@ -13,7 +13,7 @@ COPY ["Components/Components.csproj", "Components/"]
|
|||||||
COPY ["nuget.config", "./"]
|
COPY ["nuget.config", "./"]
|
||||||
|
|
||||||
# Ripristina le dipendenze per tutti i progetti con package cache ultra-corto
|
# Ripristina le dipendenze per tutti i progetti con package cache ultra-corto
|
||||||
RUN dotnet restore "Data_Coupler/Data_Coupler.csproj" --disable-parallel --packages /p
|
RUN dotnet restore "Data_Coupler/Data_Coupler.csproj" --runtime win-x64 --disable-parallel --packages /p
|
||||||
|
|
||||||
# Copia tutto il codice sorgente
|
# Copia tutto il codice sorgente
|
||||||
COPY ["Data_Coupler/", "Data_Coupler/"]
|
COPY ["Data_Coupler/", "Data_Coupler/"]
|
||||||
@@ -27,7 +27,7 @@ RUN dotnet build "Data_Coupler.csproj" -c Release -o /o --no-restore
|
|||||||
|
|
||||||
# Stage 2: Publish
|
# Stage 2: Publish
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
RUN dotnet publish "Data_Coupler.csproj" -c Release -o /p --no-restore /p:UseAppHost=false
|
RUN dotnet publish "Data_Coupler.csproj" -c Release -o /p --no-restore -r win-x64 --self-contained false
|
||||||
|
|
||||||
# Stage 3: Runtime
|
# Stage 3: Runtime
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0-nanoserver-ltsc2022 AS final
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0-nanoserver-ltsc2022 AS final
|
||||||
|
|||||||
Reference in New Issue
Block a user