Skip to content
Snippets Groups Projects
Commit a40a99d3 authored by Niaz Faridani-Rad's avatar Niaz Faridani-Rad
Browse files
parents de587a94 f0a48757
No related branches found
No related tags found
No related merge requests found
name: Docker
name: backend
on:
repository_dispatch:
......@@ -31,7 +31,7 @@ jobs:
- name: Run tests
run: docker build ./backend
myEvent:
build:
# Ensure test job passes before pushing image.
needs: test
......
name: frontend
on:
repository_dispatch:
types: frontend-commit-event
push:
# Publish `dev` as Docker `latest` image.
branches:
- dev
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
env:
IMAGE_NAME: librephotos-frontend
jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
run: docker build ./frontend
build:
# Ensure test job passes before pushing image.
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build image
run: docker build ./frontend --tag $IMAGE_NAME
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Push image
run: |
IMAGE_ID=reallibrephotos/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `dev` tag
VERSION=dev
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
......@@ -13,7 +13,7 @@ RUN curl -SL https://s3.eu-central-1.amazonaws.com/ownphotos-deploy/places365_mo
RUN curl -SL https://s3.eu-central-1.amazonaws.com/ownphotos-deploy/im2txt_model.tar.gz | tar -zxC /data_models/im2txt/
RUN curl -SL https://s3.eu-central-1.amazonaws.com/ownphotos-deploy/im2txt_data.tar.gz | tar -zxC /data_models/im2txt/
RUN curl -SL https://download.pytorch.org/models/resnet152-b121ed2d.pth -o /root/.cache/torch/hub/checkpoints/resnet152-b121ed2d.pth
RUN pip install torch==1.7.1+cpu torchvision==0.8.2+cpu -f https://download.pytorch.org/whl/torch_stable.html
RUN pip install torch==1.8.0+cpu torchvision==0.9.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
RUN pip install -v --install-option="--no" --install-option="DLIB_USE_CUDA" --install-option="--no" --install-option="USE_AVX_INSTRUCTIONS" --install-option="--no" --install-option="USE_SSE4_INSTRUCTIONS" dlib
# actual project
ARG DEBUG
......
#! /bin/bash
export PYTHONUNBUFFERED=TRUE
mkdir -p /logs
service statd start
python image_similarity/main.py 2>&1 | tee /logs/gunicorn_image_similarity.log &
python manage.py showmigrations | tee /logs/show_migrate.log
python manage.py migrate | tee /logs/command_migrate.log
......
......@@ -22,7 +22,7 @@ services:
- frontend
db:
image: postgres
image: postgres:13
restart: always
environment:
- POSTGRES_USER=${dbUser}
......@@ -66,11 +66,12 @@ services:
- WEB_CONCURRENCY=${gunniWorkers}
- SKIP_PATTERNS=${skipPatterns}
- DEBUG=0
- HEAVYWEIGHT_PROCESS=${HEAVYWEIGHT_PROCESS}
# Wait for Postgres
depends_on:
- db
redis:
image: redis
image: redis:6
restart: always
......@@ -61,12 +61,16 @@ dbUser=docker
# The password used by the database.
dbPass=AaAa1234
# This setting can dramatically affect how resource-intensive and the speed of scanning photos
# Number of workers, which take care of the request to the api. This setting can dramatically affect the ram usage.
# A positive integer generally in the 2-4 x $(NUM_CORES) range.
# You’ll want to vary this a bit to find the best for your particular workload.
# Each worker needs 800MB of RAM. Change at your own will. Default is 2.
gunniWorkers=2
# Number of workers, when scanning pictures. This setting can dramatically affect the ram usage.
# Each worker needs 800MB of RAM. Change at your own will. Default is 1.
HEAVYWEIGHT_PROCESS=1
# ---------------------------------------------------------------------------------------------
# If you are not a developer ignore the following parameters: you will never need them.
......
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