diff --git a/.github/workflows/build-ptp.yaml b/.github/workflows/build-ptp.yaml index 36340d3..27c9370 100644 --- a/.github/workflows/build-ptp.yaml +++ b/.github/workflows/build-ptp.yaml @@ -31,7 +31,7 @@ jobs: env: REGISTRY: ghcr.io - IMAGE_NAME: 'ptp' + IMAGE_NAME: ${{ github.repository }} #DOCKER_USER: ${{ secrets.DOCKER_USER }} #DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} working-directory: ./ptp @@ -69,7 +69,7 @@ jobs: with: # list of Docker images to use as base name for tags images: | - ghcr.io/pharmbio/ptp + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} # generate Docker tags based on the following events/attributes tags: | type=schedule diff --git a/ptp/Dockerfile b/ptp/Dockerfile index e1b3f54..56a2ff2 100644 --- a/ptp/Dockerfile +++ b/ptp/Dockerfile @@ -30,8 +30,7 @@ FROM djangobase AS djangoapp COPY . /app/ WORKDIR /app - - +RUN mkdir /app/inference/models/ # Expose the port the Django app runs on EXPOSE 8000 @@ -41,16 +40,16 @@ RUN useradd -u 1000 $USER RUN chown -R $USER:$USER /etc/supervisor/conf.d/supervisord.conf RUN chown -R $USER:$USER /app/ RUN chown -R $USER:$USER /var/log/supervisor/ -RUN chmod +x /app/start-single.sh +RUN chmod +x /app/start-script.sh RUN chmod +x /app/start-django.sh -RUN chmod +x /app/download.sh # Make sure the container is running as non-root USER $USER ENV CELERY_BROKER_URL="redis://localhost:6379/0" ENV REDIS_URL="redis://localhost:6379/0" -ENV DOWNLOAD=false +ENV MODEL_DIR = "/app/inference/models/models" +# Models will be downloaded and placed in /app/inference/models/models through SciLifeLab Serve interface # Start supervisord -CMD ["sh", "-c", "/app/start-single.sh"] \ No newline at end of file +CMD ["sh", "-c", "/app/start-script.sh"] diff --git a/ptp/download.sh b/ptp/download.sh deleted file mode 100644 index adec30f..0000000 --- a/ptp/download.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -if [ "$DOWNLOAD" = "true" ]; then - git clone https://huggingface.co/pharmbio/ptp /app/inference/models && \ - cd /app/inference/models && \ - git lfs pull -else - echo "noop" -fi -exit 0 \ No newline at end of file diff --git a/ptp/start-script.sh b/ptp/start-script.sh new file mode 100644 index 0000000..94c994d --- /dev/null +++ b/ptp/start-script.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +sh -c /app/start-django.sh +supervisord -c /etc/supervisor/conf.d/supervisord.conf diff --git a/ptp/start-single.sh b/ptp/start-single.sh deleted file mode 100644 index 39771ee..0000000 --- a/ptp/start-single.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -echo "downloading models.." -sh -c /app/download.sh -echo "done!" -echo "starting serving..." - -sh -c /app/start-django.sh -supervisord -c /etc/supervisor/conf.d/supervisord.conf \ No newline at end of file