github.com/cozy/cozy-stack@v0.0.0-20240327093429-939e4a21320e/docs/docker.md (about) 1 [Table of contents](README.md#table-of-contents) 2 3 # Docker 4 5 This page list various operations that can be automated _via_ Docker when 6 developing cozy-stack. 7 8 For docker usage in production to self-host your cozy instance, please refer 9 to our [Self Hosting Documentation](https://docs.cozy.io/en/tutorials/selfhosting/). 10 11 ## Running a CouchDB instance 12 13 This will run a new instance of CouchDB in `single` mode (no cluster). This 14 command exposes couchdb on the port `5984`. 15 16 ```bash 17 $ docker run -d \ 18 --name cozy-stack-couch \ 19 -p 5984:5984 \ 20 -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password \ 21 -v $HOME/.cozy-stack-couch:/opt/couchdb/data \ 22 couchdb:3.3 23 $ curl -X PUT http://admin:password@127.0.0.1:5984/{_users,_replicator} 24 ``` 25 26 Verify your installation at: http://127.0.0.1:5984/_utils/#verifyinstall. 27 28 Note: for running some unit tests, you will need to use `--net=host` instead of 29 `-p 5984:5984` as we are using CouchDB replications and CouchDB will need to be 30 able to open a connexion to the stack. 31 32 ## Building a cozy-stack _via_ Docker 33 34 Warning, this command will build a linux binary. Use 35 [`GOOS` and `GOARCH`](https://golang.org/doc/install/source#environment) to 36 adapt to your own system. 37 38 ```bash 39 # From your cozy-stack developement folder 40 docker run -it --rm --name cozy-stack \ 41 --workdir /app \ 42 -v $(pwd):/app \ 43 -v $(pwd):/go/bin \ 44 golang:1.22 \ 45 go get -v github.com/cozy/cozy-stack 46 ``` 47 48 ## Publishing a new cozy-app-dev image 49 50 We publish the cozy-app-dev image when we release a new version of the stack. 51 See `scripts/docker/cozy-app-dev/release.sh` for details. 52 53 ## Docker run and url name for cozy-app-dev 54 55 A precision for the app name: 56 57 ```bash 58 docker run --rm -it -p 8080:8080 -v "$(pwd)/build":/data/cozy-app/***my-app*** cozy/cozy-app-dev 59 ``` 60 61 ***my-app*** will be the first part of: ***my-app***.cozy.localhost:8080 62 63 ## Only-Office document server 64 65 The `cozy/onlyoffice-dev` docker image can be used for local development on 66 Linux (the `--net=host` option doesn't work on macOS). Just start it with: 67 68 ```bash 69 $ docker run -it --rm --name=oodev --net=host cozy/onlyoffice-dev 70 ``` 71 72 and run the stack with: 73 74 ```bash 75 $ cozy-stack serve --disable-csp --onlyoffice-url=http://localhost:8000 --onlyoffice-inbox-secret=inbox_secret --onlyoffice-outbox-secret=outbox_secret 76 $ cozy-stack features defaults '{"drive.office": {"enabled": true, "write": true}}' 77 ``` 78 79 If you need to rebuild it, you can do that with: 80 81 ```bash 82 $ cd scripts/onlyoffice-dev 83 $ docker build -t "cozy/onlyoffice-dev" . 84 ```