#####################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#####################################################################

version: "2.4"

services:
  db:
    image: postgres:13
    mem_limit: 300M
    memswap_limit: 300M
    cpu_shares: 200
    restart: "no"
    volumes:
      - ./postgres-initdb.d:/docker-entrypoint-initdb.d
    env_file:
      - postgres.env
      - ofbiz-postgres.env

  ofbiz:
    image: ofbiz-docker
    mem_limit: 1600M
    memswap_limit: 1600M
    cpu_shares: 200
    ports:
      - 8443:8443
    volumes:
      - ./after-config-applied.d:/docker-entrypoint-hooks/after-config-applied.d
      # Note, on Unix systems, ensure the ofbiz user (uid 1000) or group (gid 1000) running inside the container has
      # write access to this directory on the host. If user namespace remapping is in use, the ofbiz user/group may
      # be mapped to host uid 165536 or gid 166536 depending on the configuration in /etc/subuid and /etc/subgid.
      - ./logs:/ofbiz/runtime/logs
    env_file:
      - ofbiz-postgres.env
    environment:
      OFBIZ_DATA_LOAD: demo
      OFBIZ_HOST: example.internal
      OFBIZ_CONTENT_URL_PREFIX: https://example.internal:8443
