Skip to content
Snippets Groups Projects
Commit 3d0042bf authored by Matteo Parrucci's avatar Matteo Parrucci
Browse files

fixed proxyng and moved frontend install and build on entrypoint

parent acad4334
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,7 @@ WORKDIR /code ...@@ -19,7 +19,7 @@ WORKDIR /code
RUN git clone https://github.com/parruc/librephotos . RUN git clone https://github.com/parruc/librephotos .
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
RUN python -m spacy download en_core_web_sm RUN python -m spacy download en_core_web_sm
EXPOSE 80 EXPOSE 8001
# TODO: prod vs dev requirements using docker-compose args # TODO: prod vs dev requirements using docker-compose args
# TODO: in dev copiare anche i vscode settings # TODO: in dev copiare anche i vscode settings
#! /bin/bash #! /bin/bash
export PYTHONUNBUFFERED=TRUE export PYTHONUNBUFFERED=TRUE
pip install torch==1.7.1+cpu torchvision==0.8.2+cpu faiss-cpu django-picklefield
mkdir -p /logs mkdir -p /logs
...@@ -17,6 +16,6 @@ echo "Running backend server..." ...@@ -17,6 +16,6 @@ echo "Running backend server..."
python manage.py rqworker default 2>&1 | tee /logs/rqworker.log & python manage.py rqworker default 2>&1 | tee /logs/rqworker.log &
if [ $(ps -ef | grep -c "myApplication") -eq 1 ]; then echo "true"; fi if [ $(ps -ef | grep -c "myApplication") -eq 1 ]; then echo "true"; fi
[ "$DEBUG" = 1 ] && RELOAD=" --reload" || RELOAD="" [ "$DEBUG" = 1 ] && RELOAD="--reload" || RELOAD=""
gunicorn --worker-class=gevent --timeout $WORKER_TIMEOUT $RELOAD --bind backend:8001 --log-level=info ownphotos.wsgi 2>&1 | tee /logs/gunicorn_django.log gunicorn --worker-class=gevent --timeout $WORKER_TIMEOUT $RELOAD --bind backend:8001 --log-level=info ownphotos.wsgi 2>&1 | tee /logs/gunicorn_django.log
...@@ -21,6 +21,8 @@ services: ...@@ -21,6 +21,8 @@ services:
build: build:
context: . context: .
dockerfile: frontend/Dockerfile dockerfile: frontend/Dockerfile
volumes:
- ${codedir}/frontend:/usr/src/app
backend: backend:
tty: true tty: true
...@@ -34,11 +36,10 @@ services: ...@@ -34,11 +36,10 @@ services:
- ${myPhotos}:/data - ${myPhotos}:/data
- ${proMedia}:/protected_media - ${proMedia}:/protected_media
- ${logLocation}:/logs - ${logLocation}:/logs
- ${codedir}:/code - ${codedir}/backend:/code
- ${cachedir}:/root/.cache - ${cachedir}:/root/.cache
pgadmin: pgadmin:
container_name: librephotos_pgadmin
image: dpage/pgadmin4 image: dpage/pgadmin4
environment: environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-admin@admin.com} PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-admin@admin.com}
......
...@@ -5,12 +5,10 @@ RUN apt-get update && apt-get install -y curl git xsel ...@@ -5,12 +5,10 @@ RUN apt-get update && apt-get install -y curl git xsel
RUN mkdir -p /usr/src/app RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app WORKDIR /usr/src/app
RUN npm install -g npm RUN npm install -g npm
RUN npm install -g serve
ENV CLI_WIDTH 80 ENV CLI_WIDTH 80
RUN git clone https://github.com/LibrePhotos/librephotos-frontend.git /usr/src/app RUN git clone https://github.com/LibrePhotos/librephotos-frontend.git /usr/src/app
RUN npm ci
RUN npm install -g serve
EXPOSE 3000
RUN npm run build EXPOSE 3000
RUN ["chmod", "+x", "./run.sh" ] RUN ["chmod", "+x", "./run.sh" ]
\ No newline at end of file
#!/usr/bin/env bash #!/usr/bin/env bash
#echo "building frontend" echo "building frontend"
#npm run build npm install
npm run build
echo "serving frontend" echo "serving frontend"
serve build -d -l 3000 serve build -d -l 3000
......
...@@ -56,7 +56,7 @@ mapApiKey= ...@@ -56,7 +56,7 @@ mapApiKey=
tag=dev tag=dev
# You can set the database name. Did you know Libre Photos was forked from OwnPhotos? # You can set the database name. Did you know Libre Photos was forked from OwnPhotos?
dbName=ownphotos dbName=librephotos
# Here you can change the user name for the database. # Here you can change the user name for the database.
dbUser=docker dbUser=docker
......
...@@ -19,7 +19,11 @@ http { ...@@ -19,7 +19,11 @@ http {
proxy_pass http://frontend:3000/; proxy_pass http://frontend:3000/;
} }
location /api { location /api {
proxy_pass http://backend/api; proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
include uwsgi_params;
proxy_pass http://backend:8001;
} }
} }
} }
\ No newline at end of file
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