Before you start, make sure you have Git and Docker installed on your system. Instead of using Docker, you can create your own development environment based on our Dockerfile (not recommended). You'll need Go >= 1.11, TensorFlow for C, Make, NPM and MySQL. Without Docker, test results will be less reliable and you also won't be able to use our other Dockerfiles (e.g. for TensorFlow).
Step 1: Run Git to clone this project:
git clone [email protected]:photoprism/photoprism.git
If you're on windows, make sure to disable auto CR LF. Otherwise, the build won't work.
git config --global core.autocrlf false
Step 2: Start Docker containers:
cd photoprism docker-compose up
Note: This docker-compose configuration is for testing and development purposes only.
Step 3: Open a terminal to the photoprism container:
docker-compose exec photoprism bash
Now you can run commands inside this terminal. To run the Go webserver, run:
make dep-tensorflow dep-go generate make build-go ./photoprism start
You can see a list of all
make targets in our Makefile. For example,
make test will run the tests and
make install will build a
photoprism production binary without debug information and install it in the user's directory including all assets.
Step 4: Build the frontend in watch mode:
The Go webserver will serve static assets in addition to providing the backend API. The static assets can automatically built whenever you change a file. In a new terminal window, outside the Docker container, run:
make dep-js make watch-js
- Radomir Sohlich wrote a pragmatic introduction to Makefiles for Go developers.
- We are using Go Modules for managing our dependencies (new in 1.11).
- If you never used Go before and would like to learn it, you are welcome to reach out. We might start organizing regular learning sessions for beginners in Berlin.
- This guide was not tested on Windows, you might need to change docker-compose.yml to make it work with Windows specific paths.
Alternate Development Environment's¶
The following are setup instructions for development and testing and should be avoided unless docker is either not supported or not allowed in your environment: