Skip to content
Snippets Groups Projects
Commit bbdd0128 authored by Niaz Faridani-Rad's avatar Niaz Faridani-Rad
Browse files

Merge branch 'main' of https://github.com/librephotos/librephotos-docker into main

parents 176cd88c 5e520836
No related branches found
No related tags found
No related merge requests found
name: Docker name: Docker
on: on:
repository_dispatch:
types: backend-commit-event
push: push:
# Publish `dev` as Docker `latest` image. # Publish `dev` as Docker `latest` image.
branches: branches:
...@@ -26,28 +29,19 @@ jobs: ...@@ -26,28 +29,19 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Run tests - name: Run tests
run: | run: docker build ./backend
if [ -f docker-compose.test.yml ]; then
docker-compose --file docker-compose.test.yml build myEvent:
docker-compose --file docker-compose.test.yml run sut
else
DOCKER_BUILDKIT=1 docker build . --file Dockerfile
fi
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
# Ensure test job passes before pushing image. # Ensure test job passes before pushing image.
needs: test needs: test
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name == 'push'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Build image - name: Build image
run: DOCKER_BUILDKIT=1 docker build . --file Dockerfile --tag $IMAGE_NAME run: docker build ./backend --tag $IMAGE_NAME
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v1 uses: docker/login-action@v1
......
# For common users: # For common users:
Set the needed variables in .env (take librephotos.env as model) Follow the instructions [here](https://docs.librephotos.com/1/standard_install/)
Clone the repo: `git clone git@github.com:LibrePhotos/librephotos-docker.git` # For ARM users:
Follow the instructions [here](https://docs.librephotos.com/1/arm_install/)
docker-compose up -d
This will get the pre-built images and start all the needed processes
# For developers: # For developers:
Set the needed variables in .evn (take librephotos.env as model) Follow the instructions [here](https://docs.librephotos.com/1/dev_install/)
Also set the codedir variable that tells docker where your source folder are
Pull frontend code with `git clone https://github.com/LibrePhotos/librephotos-frontend.git ${codedir}/frontend/`
Pull backend code into `git clone https://github.com/LibrePhotos/librephotos.git ${codedir}/backend/`
Pull this repo and 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
N.B. If you already built this image once, when you do force rebuild you have to run
`docker-compose -f docker-compose.yml -f docker-compose.dev.yml build --no-cache frontend`
`docker-compose -f docker-compose.yml -f docker-compose.dev.yml build --no-cache backend`
based on which one you changed if these changes need rebuild as for added dependencies/libraries etc.
and then the usual `docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d`
If you use vscode you can also benefit auto completion and other goodies. For this just type `code .` in your dockerfile folder.
Vscode will open and ask you if you want to reopen it in the container. If you do it he will add his server to the docker layers (first time you do it can take a couple of minutes) and you will have the same python interpreter librephotos is using internally hence the same installed libraries in auto completion and the same development environment will be shared by all devs (isort, flake8 and pylint for example)
FROM python:3.8 FROM python:3.8
# system packages installation # system packages installation
RUN apt update && apt install -y curl libopenblas-dev libmagickwand-dev libheif-dev libmagic1 ufraw-batch libboost-all-dev libxrender-dev liblapack-dev git bzip2 cmake build-essential libsm6 libglib2.0-0 libgl1-mesa-glx --no-install-recommends
RUN apt update && apt install -y curl nfs-common cifs-utils libopenblas-dev libmagickwand-dev libheif-dev libmagic1 ufraw-batch libboost-all-dev libxrender-dev liblapack-dev git bzip2 cmake build-essential libsm6 libglib2.0-0 libgl1-mesa-glx --no-install-recommends
# pre trained models download # pre trained models download
WORKDIR /data_models WORKDIR /data_models
......
# DO NOT EDIT
# The .env file has everything you need to edit.
# Run options:
# 1. Use prebuilt images (preferred method):
# run cmd: docker-compose up -d
# 2. Build images on your own machine:
# build cmd: COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose build
# run cmd: docker-compose up -d
version: '3.8'
services:
proxy:
image: radicand/librephotos-proxy-arm:test
restart: always
volumes:
- ${myPhotos}:/data
- ${proMedia}:/protected_media
ports:
- ${httpPort}:80
depends_on:
- backend
- frontend
db:
image: postgres
restart: always
environment:
- POSTGRES_USER=${dbUser}
- POSTGRES_PASSWORD=${dbPass}
- POSTGRES_DB=${dbName}
volumes:
- ${dbLocation}:/var/lib/postgresql/data
command: postgres -c fsync=off -c synchronous_commit=off -c full_page_writes=off -c random_page_cost=1.0
frontend:
image: radicand/librephotos-frontend-arm:latest
restart: always
depends_on:
- backend
backend:
image: radicand/librephotos-backend-arm:latest
restart: always
volumes:
- ${myPhotos}:/data
- ${proMedia}:/protected_media
- ${logLocation}:/logs
- ${cachedir}:/root/.cache
environment:
- SECRET_KEY=${shhhhKey}
- BACKEND_HOST=backend
- ADMIN_EMAIL=${adminEmail}
- ADMIN_USERNAME=${userName}
- ADMIN_PASSWORD=${userPass}
- DB_BACKEND=postgresql
- DB_NAME=${dbName}
- DB_USER=${dbUser}
- DB_PASS=${dbPass}
- DB_HOST=db
- DB_PORT=5432
- REDIS_HOST=redis
- REDIS_PORT=6379
- MAPBOX_API_KEY=${mapApiKey}
- TIME_ZONE=${timeZone}
- WEB_CONCURRENCY=${gunniWorkers}
- SKIP_PATTERNS=${skipPatterns}
- DEBUG=0
# Wait for Postgres
depends_on:
- db
redis:
image: redis
restart: always
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment