Skip to main content

👷‍♂️ Installation

Quality Gate Status Discord Website GitHub contributors

For Developers

info
  • Do not use a relative path, because the sudo command usually starts in the root folder and does not represent the actual folder you are in.
  • When using docker compose v2, replace command docker-compose with docker compose in the following instructions.

Create a directory for the project: this is where all the Git repositories will be cloned into. In this guide, we will use "~/home/dev/librephotos as an example.

Pull frontend code with git clone https://github.com/LibrePhotos/librephotos-frontend.git

Pull backend code into git clone https://github.com/LibrePhotos/librephotos.git

Pull librephotos-docker repo git clone https://github.com/LibrePhotos/librephotos-docker.git

Setting up in Linux

codedir=~/home/dev/librephotos
cd $codedir
git clone https://github.com/LibrePhotos/librephotos-frontend.git
git clone https://github.com/LibrePhotos/librephotos.git
git clone https://github.com/LibrePhotos/librephotos-docker.git

Setting up on Windows

In PowerShell:

$Env:codedir = "~/home/dev/librephotos"
CD $Env:codedir
git clone https://github.com/LibrePhotos/librephotos-frontend.git
git clone https://github.com/LibrePhotos/librephotos.git
git clone https://github.com/LibrePhotos/librephotos-docker.git

Configuring the environment

Go to the librephotos-docker directory you just cloned. Create a new file .env (take librephotos.env as a reference) and set the needed variables in it. Make sure you set the codedir variable that tells docker, where your source folders are. This should be the same path as used to clone your repos.

Run docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d

This will build images from scratch (can take a long time the first time). Now you can develop and benefit from code auto reload from both backend and frontend

If you already built this image once, when you do force rebuild you have to run the build command based on which area you changed with added dependencies/libraries etc.

docker-compose -f docker-compose.yml -f docker-compose.dev.yml  build --no-cache frontend
# OR
docker-compose -f docker-compose.yml -f docker-compose.dev.yml build --no-cache backend

Once you have rebuilt, you can run the docker compose up command again to update the running instances.

docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d

Visual Studio Code

If you use Visual Studio Code, you can also benefit from auto-completion and other goodies. For this, just run code . in your Dockerfile folder, which is ~/home/dev/librephotos/librephotos-docker in our example.

Visual Studio Code will open and ask you if you want to reopen it in the container. If you do, it will create the images from scratch (first time you do it can take a couple of minutes), and you will have the same Python interpreter LibrePhotos uses internally - and hence the same installed libraries in auto-completion, and the same development environment, will be shared by all devs. This includes tools like isort, flake8 and pylint.

Alternatively, you can run the Remote-Containers: Open Folder in Container command from the Command Palette. Note in order to open this container, you must have the required dependencies installed. More details can be found here.

Next Steps

Next, take a look at the first steps after setup.