In this page you will find our recommended way of installing Docker on your machine. This guide is made for OSX users.
First install Docker using Homebrew
$ brew install docker
You can then install Docker Desktop if you wish, or use docker-machine
. As we prefer the second option, we will only document this one.
Install docker-machine
$ brew install docker-machine
Then install VirtualBox with Homebrew Cask to get a driver for your Docker machine
$ brew cask install virtualbox
You may need to enter your password and authorize the application in your System Settings
> Security & Privacy
.
Create now a new machine, set it up as default and connect your shell to it (here we use zsh. The commands should anyway be displayed in each steps' output)
$ docker-machine create --driver virtualbox default
$ docker-machine env default
$ eval "$(docker-machine env default)"
Now you're all setup to use our provided Docker image!
docker build -t algolia-kotlin .
You need to provide few environment variables at runtime to be able to run the Common Test Suite. You can set them up directly in the command:
docker run -it --rm --env ALGOLIA_APP_ID=XXXXXX [...] -v $PWD:/app -w /app algolia-kotlin bash
However, we advise you to export them in your .bashrc
or .zshrc
. That way, you can use Docker's shorten syntax to set your variables.
### For external contributors, only the following env variables should be enough
docker run -it --rm --env ALGOLIA_APPLICATION_ID_1 \
--env ALGOLIA_ADMIN_KEY_1 \
--env ALGOLIA_SEARCH_KEY_1 \
-v $PWD:/app -w /app algolia-kotlin bash
### This is needed only to run the full test suite
docker run -it --rm --env ALGOLIA_APPLICATION_ID_1 \
--env ALGOLIA_ADMIN_KEY_1 \
--env ALGOLIA_SEARCH_KEY_1 \
--env ALGOLIA_APPLICATION_ID_2 \
--env ALGOLIA_ADMIN_KEY_2 \
--env ALGOLIA_APPLICATION_ID_MCM \
--env ALGOLIA_ADMIN_KEY_MCM \
-v $PWD:/app -w /app algolia-kotlin bash
Once your container is running, any changes you make in your IDE are directly reflected in the container.
To build and run tests, you can use the following commands:
# build the project
./gradlew assemble
# run tests
./gradlew jvmTest
Feel free to contact us if you have any questions.