From 38c87e5b7241564121b3b4e67b208d4451f245a8 Mon Sep 17 00:00:00 2001 From: Bohdan Kucherivayi Date: Thu, 15 Feb 2024 17:24:59 +0200 Subject: [PATCH] fix: containers --- compose.yaml | 6 +-- docker-compose.yml | 90 ++++++++++++++++----------------- images/custom/Containerfile | 8 +-- images/production/Containerfile | 8 +-- 4 files changed, 52 insertions(+), 60 deletions(-) diff --git a/compose.yaml b/compose.yaml index 05913953..b9d45209 100644 --- a/compose.yaml +++ b/compose.yaml @@ -9,7 +9,7 @@ x-depends-on-configurator: &depends_on_configurator x-backend-defaults: &backend_defaults <<: [*depends_on_configurator, *customizable_image] volumes: - - sites:/home/zapal/frappe-bench/sites + - ./data:/home/zapal/frappe-bench services: configurator: @@ -52,7 +52,7 @@ services: PROXY_READ_TIMEOUT: ${PROXY_READ_TIMEOUT:-120} CLIENT_MAX_BODY_SIZE: ${CLIENT_MAX_BODY_SIZE:-50m} volumes: - - sites:/home/zapal/frappe-bench/sites + - ./data:/home/zapal/frappe-bench depends_on: - backend - websocket @@ -63,7 +63,7 @@ services: - node - /home/zapal/frappe-bench/apps/frappe/socketio.js volumes: - - sites:/home/zapal/frappe-bench/sites + - ./data:/home/zapal/frappe-bench queue-short: <<: *backend_defaults diff --git a/docker-compose.yml b/docker-compose.yml index 6c6647e9..ce1e1957 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,14 +5,15 @@ services: configurator: condition: service_completed_successfully required: true - image: ghcr.io/zapal-tech/erp:latest + image: zapal-tech/erp:latest networks: default: null volumes: - - type: volume - source: sites - target: /home/zapal/frappe-bench/sites - volume: {} + - type: bind + source: ./data + target: /home/zapal/frappe-bench + bind: + create_host_path: true configurator: command: - | @@ -36,14 +37,15 @@ services: REDIS_CACHE: redis-cache:6379 REDIS_QUEUE: redis-queue:6379 SOCKETIO_PORT: "9000" - image: ghcr.io/zapal-tech/erp:latest + image: zapal-tech/erp:latest networks: default: null volumes: - - type: volume - source: sites - target: /home/zapal/frappe-bench/sites - volume: {} + - type: bind + source: ./data + target: /home/zapal/frappe-bench + bind: + create_host_path: true db: command: - --character-set-server=utf8mb4 @@ -85,19 +87,15 @@ services: UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1 UPSTREAM_REAL_IP_HEADER: X-Forwarded-For UPSTREAM_REAL_IP_RECURSIVE: "off" - image: ghcr.io/zapal-tech/erp:latest + image: zapal-tech/erp:latest networks: default: null - ports: - - mode: ingress - target: 8080 - published: "8080" - protocol: tcp volumes: - - type: volume - source: sites - target: /home/zapal/frappe-bench/sites - volume: {} + - type: bind + source: ./data + target: /home/zapal/frappe-bench + bind: + create_host_path: true queue-long: command: - bench @@ -108,14 +106,15 @@ services: configurator: condition: service_completed_successfully required: true - image: ghcr.io/zapal-tech/erp:latest + image: zapal-tech/erp:latest networks: default: null volumes: - - type: volume - source: sites - target: /home/zapal/frappe-bench/sites - volume: {} + - type: bind + source: ./data + target: /home/zapal/frappe-bench + bind: + create_host_path: true queue-short: command: - bench @@ -126,14 +125,15 @@ services: configurator: condition: service_completed_successfully required: true - image: ghcr.io/zapal-tech/erp:latest + image: zapal-tech/erp:latest networks: default: null volumes: - - type: volume - source: sites - target: /home/zapal/frappe-bench/sites - volume: {} + - type: bind + source: ./data + target: /home/zapal/frappe-bench + bind: + create_host_path: true redis-cache: image: redis:6.2-alpine networks: @@ -160,14 +160,15 @@ services: configurator: condition: service_completed_successfully required: true - image: ghcr.io/zapal-tech/erp:latest + image: zapal-tech/erp:latest networks: default: null volumes: - - type: volume - source: sites - target: /home/zapal/frappe-bench/sites - volume: {} + - type: bind + source: ./data + target: /home/zapal/frappe-bench + bind: + create_host_path: true websocket: command: - node @@ -176,14 +177,15 @@ services: configurator: condition: service_completed_successfully required: true - image: ghcr.io/zapal-tech/erp:latest + image: zapal-tech/erp:latest networks: default: null volumes: - - type: volume - source: sites - target: /home/zapal/frappe-bench/sites - volume: {} + - type: bind + source: ./data + target: /home/zapal/frappe-bench + bind: + create_host_path: true networks: default: name: erp_default @@ -194,17 +196,15 @@ volumes: name: erp_redis-cache-data redis-queue-data: name: erp_redis-queue-data - sites: - name: erp_sites x-backend-defaults: depends_on: configurator: condition: service_completed_successfully - image: ghcr.io/zapal-tech/erp:latest + image: zapal-tech/erp:latest volumes: - - sites:/home/zapal/frappe-bench/sites + - ./data:/home/zapal/frappe-bench x-customizable-image: - image: ghcr.io/zapal-tech/erp:latest + image: zapal-tech/erp:latest x-depends-on-configurator: depends_on: configurator: diff --git a/images/custom/Containerfile b/images/custom/Containerfile index 0240d5b9..f3a7552e 100644 --- a/images/custom/Containerfile +++ b/images/custom/Containerfile @@ -132,7 +132,7 @@ RUN bench get-app --branch=${HRMS_BRANCH} --resolve-deps hrms ${HRMS_REPO} RUN echo "frappe\nhrms\nerpnext" > sites/apps.txt RUN echo "{}" > sites/common_site_config.json # DO NOT REMOVE .git FOLDERS -# RUN find apps -mindepth 1 -path "*/.git" | xargs rm -fr +# RUN find apps -mindepth 1 -path "*/.git" | xargs git remote rm upstream FROM base as erp @@ -144,11 +144,7 @@ COPY /usr/local/bin/nginx-entrypoint.sh /usr/local/bin/nginx-entrypoint.sh WORKDIR /home/zapal/frappe-bench -VOLUME [ \ - "/home/zapal/frappe-bench/sites", \ - "/home/zapal/frappe-bench/sites/assets", \ - "/home/zapal/frappe-bench/logs" \ -] +VOLUME ["/home/zapal/frappe-bench"] CMD [ \ "/home/zapal/frappe-bench/env/bin/gunicorn", \ diff --git a/images/production/Containerfile b/images/production/Containerfile index a4505dba..68d7519b 100644 --- a/images/production/Containerfile +++ b/images/production/Containerfile @@ -126,7 +126,7 @@ RUN bench get-app --branch=${HRMS_BRANCH} --resolve-deps hrms ${HRMS_REPO} RUN echo "frappe\nhrms\nerpnext" > sites/apps.txt RUN echo "{}" > sites/common_site_config.json # DO NOT REMOVE .git FOLDERS -# RUN find apps -mindepth 1 -path "*/.git" | xargs rm -fr +# RUN find apps -mindepth 1 -path "*/.git" | xargs git remote rm upstream FROM base as erp @@ -136,11 +136,7 @@ COPY --from=builder --chown=zapal:zapal /home/zapal/frappe-bench /home/zapal/fra WORKDIR /home/zapal/frappe-bench -VOLUME [ \ - "/home/zapal/frappe-bench/sites", \ - "/home/zapal/frappe-bench/sites/assets", \ - "/home/zapal/frappe-bench/logs" \ -] +VOLUME ["/home/zapal/frappe-bench"] CMD [ \ "/home/zapal/frappe-bench/env/bin/gunicorn", \