From f74aaac664e7a91402b883a7068975c65b47cb95 Mon Sep 17 00:00:00 2001 From: javiermengual Date: Mon, 29 Dec 2025 16:37:45 +0100 Subject: [PATCH] =?UTF-8?q?chore:=20a=C3=B1adir=20configuraci=C3=B3n=20de?= =?UTF-8?q?=20Docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 25 +++++++++++ DoliMiddlewareApi/Dockerfile | 23 ++++++++++ compose.yaml | 81 ++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 .dockerignore create mode 100644 DoliMiddlewareApi/Dockerfile create mode 100644 compose.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..38bece4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.idea +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/DoliMiddlewareApi/Dockerfile b/DoliMiddlewareApi/Dockerfile new file mode 100644 index 0000000..3ce8432 --- /dev/null +++ b/DoliMiddlewareApi/Dockerfile @@ -0,0 +1,23 @@ +FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base +USER $APP_UID +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["DoliMiddlewareApi/DoliMiddlewareApi.csproj", "DoliMiddlewareApi/"] +RUN dotnet restore "DoliMiddlewareApi/DoliMiddlewareApi.csproj" +COPY . . +WORKDIR "/src/DoliMiddlewareApi" +RUN dotnet build "./DoliMiddlewareApi.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./DoliMiddlewareApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "DoliMiddlewareApi.dll"] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..bb3f951 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,81 @@ + +services: + mysql: + image: mysql:8.0 + container_name: dolibarr-mysql + environment: + MYSQL_ROOT_PASSWORD: "rootpassword" + MYSQL_DATABASE: "dolibarr" + MYSQL_USER: "dolibarr" + MYSQL_PASSWORD: "12345678" + ports: + - "3306:3306" + volumes: + - mysql_data:/var/lib/mysql + command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-prootpassword"] + interval: 10s + timeout: 5s + retries: 5 + restart: unless-stopped + + # redis: + # image: redis:7-alpine + # container_name: dolibarr-redis + # ports: + # - "6379:6379" + # volumes: + # - redis_data:/data + # command: redis-server --appendonly yes + # healthcheck: + # test: ["CMD", "redis-cli", "ping"] + # interval: 10s + # timeout: 3s + # retries: 5 + # restart: unless-stopped + + dolibarr: + image: dolibarr/dolibarr:latest + container_name: dolibarr-web + depends_on: + mysql: + condition: service_healthy + environment: + DOLI_DB_TYPE: "mysqli" + DOLI_DB_HOST: "mysql" + DOLI_DB_HOST_PORT: "3306" + DOLI_DB_USER: "dolibarr" + DOLI_DB_PASSWORD: "12345678" + DOLI_DB_NAME: "dolibarr" + DOLI_ADMIN_LOGIN: "admin" + DOLI_ADMIN_PASSWORD: "12345678" + DOLI_URL_ROOT: "http://localhost" + ports: + - "80:80" + volumes: + - dolibarr_documents:/var/www/documents + - dolibarr_custom:/var/www/html/custom + restart: unless-stopped + + # dolimiddlewareapi: + # image: dolimiddlewareapi + # build: + # context: . + # dockerfile: DoliMiddlewareApi/Dockerfile + # container_name: dolibarr-middleware-api + # depends_on: + # - dolibarr + # - mysql + # ports: + # - "5000:8080" + # environment: + # - ASPNETCORE_ENVIRONMENT=Development + # restart: unless-stopped + +volumes: + mysql_data: + # redis_data: + dolibarr_documents: + dolibarr_custom: +