Merge branch 'main' of http://gitea.poloinformatico.it/POLO-API/ApiAdHoc_Odoo
This commit is contained in:
commit
7cd0837a8d
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
41
ApiAdHoc_Odoo/Dockerfile
Normal file
41
ApiAdHoc_Odoo/Dockerfile
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# Use the .NET SDK image for building the application
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
# Copy the project files and restore dependencies
|
||||||
|
COPY ApiAdHoc_Odoo.csproj ./
|
||||||
|
RUN dotnet restore
|
||||||
|
|
||||||
|
# Copy the rest of the source code and build the application
|
||||||
|
COPY . ./
|
||||||
|
RUN dotnet publish -c Release -o /app
|
||||||
|
|
||||||
|
# Use the ASP.NET runtime image for the final container
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy the built application from the build stage
|
||||||
|
COPY --from=build /app .
|
||||||
|
|
||||||
|
# Install dependencies for ODBC driver
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y curl gnupg2 && \
|
||||||
|
mkdir -p /usr/share/keyrings && \
|
||||||
|
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-archive-keyring.gpg && \
|
||||||
|
echo "deb [signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/debian/12/prod bookworm main" > /etc/apt/sources.list.d/mssql-release.list && \
|
||||||
|
apt-get update && \
|
||||||
|
ACCEPT_EULA=Y apt-get install -y msodbcsql18
|
||||||
|
|
||||||
|
# Lower OpenSSL security level to allow legacy TLS protocols (TLS 1.0/1.1)
|
||||||
|
RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /etc/ssl/openssl.cnf
|
||||||
|
RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /usr/lib/ssl/openssl.cnf
|
||||||
|
|
||||||
|
# Set environment variables to enable legacy TLS protocols
|
||||||
|
ENV DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0
|
||||||
|
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
|
||||||
|
|
||||||
|
# Expose the port your API will run on
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Set the entry point for the application
|
||||||
|
ENTRYPOINT ["dotnet", "ApiAdHoc_Odoo.dll"]
|
||||||
@ -2,9 +2,13 @@ using ApiAdHoc_Odoo.Data;
|
|||||||
using ApiAdHoc_Odoo.Models;
|
using ApiAdHoc_Odoo.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
// Enable legacy TLS protocols (TLS 1.0/1.1)
|
||||||
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
|
|
||||||
|
|||||||
13
ApiAdHoc_Odoo/docker-compose.yml
Normal file
13
ApiAdHoc_Odoo/docker-compose.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
api-adhoc-odoo:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "50000:8080" # HTTP
|
||||||
|
# - "50001:443" # HTTPS
|
||||||
|
environment:
|
||||||
|
ASPNETCORE_ENVIRONMENT: "Production"
|
||||||
|
volumes:
|
||||||
|
- ./logs:/app/logs # Optional: Log files storage
|
||||||
|
restart: unless-stopped
|
||||||
Loading…
Reference in New Issue
Block a user