github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/scripts/docker/production/README.md (about)

     1  # cozy-stack docker production image
     2  
     3  The files in this directory let you build a cozy-stack production image.
     4  
     5  ## Variables
     6  
     7  The following variables can be used to customize the image:
     8  
     9  - `COUCHDB_PROTOCOL`: protocol used to access couchdb (http or https).
    10    defaults to `http`
    11  - `COUCHDB_HOST`: CouchDB Host (defaults to `couchdb`)
    12  - `COUCHDB_PORT`: CouchDB Port to use (defaults to `5984`)
    13  - `COUCHDB_USER`: CouchDB User (defaults to `cozy`)
    14  - `COUCHDB_PASSWORD`: CouchDB password (defaults to `cozy`)
    15  - `COZY_ADMIN_PASSPHRASE`: The admin passphrase. If unset, a random password will be used and echoed in container logs
    16  - `START_EMBEDDED_POSTFIX`: Set it to "true" to start a out-only smtp postfix relay. Not started by default.
    17  - `LOCAL_USER_ID`: UID of the user running cozy-stack (defaults to 3552)
    18  - `LOCAL_GROUP_ID`: GID of the user running cozy-stack (defaults to 3552)
    19  - All variables that can be used to configure cozy-stack. Usually they are the command line options in upper case prefixed by COZY_ (and dashes replaced with underscores). Refer to our [documentation](https://docs.cozy.io/en/cozy-stack/config/#stack-endpoints)
    20  
    21  ## Running the cozy-stack production image
    22  
    23  Create a docker network and start couchdb attached to it
    24  
    25  ```bash
    26  docker network create cozy-stack
    27  
    28  docker run --rm -d \
    29      --name cozy-stack-couchdb \
    30      --network cozy-stack \
    31      -e COUCHDB_USER=admin \
    32      -e COUCHDB_PASSWORD=password \
    33      -v ./volumes/cozy-stack/couchdb:/opt/couchdb/data \
    34      couchdb:latest
    35  ```
    36  
    37  Then stack cozy-stack
    38  
    39  ```bash
    40  docker run --rm \
    41      --name cozy-stack \
    42      --network cozy-stack \
    43      -p 8080:8080 \
    44      -p 6060:6060 \
    45      -e COUCHDB_HOST=cozy-stack-couchdb \
    46      -e COUCHDB_USER=admin \
    47      -e COUCHDB_PASSWORD=password \
    48      -e COZY_HOST=127.0.0.1 \
    49      -e COZY_ADMIN_HOST=127.0.0.1 \
    50      -e COZY_COUCHDB_URL=http://admin:password@cozy-stack-couchdb:5984 \
    51      -e COZY_FS_URL=file:///var/lib/cozy \
    52      -v ./volumes/cozy-stack/data:/var/lib/cozy \
    53      -v ./volumes/cozy-stack/config:/etc/cozy/ \
    54      cozy/cozy-stack:latest
    55  ```
    56  
    57  you can configure the stack by adding a `cozy.yml` file in your `cozy-stack/config` volume (and remove the `COZY_*` variables).
    58  
    59  ## Building the image
    60  
    61  simply execute the following command from the cozy-stack repo root
    62  
    63  ```bash
    64  docker build -t "cozy/cozy-stack:latest"  -f scripts/docker/production/Dockerfile .
    65  ```