Skip to content

Commit

Permalink
Adapting pipelines for poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
pchlap committed Sep 6, 2022
1 parent 31deba5 commit f5d5004
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 57 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ jobs:
python-version: '3.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install -r requirements.txt
pip install -r requirements-backend.txt
curl -sSL https://install.python-poetry.org | python - --version 1.2.0rc1
poetry install --with docs
echo "PYTHONPATH=`pwd`" >> $GITHUB_ENV
- name: Build docs
run: |
sudo apt-get update -y && sudo apt-get install -y pandoc
sphinx-build -b html -a docs docs/site
poetry run sphinx-build -b html -a docs docs/site
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ jobs:
python-version: '3.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install -r requirements.txt
pip install -r requirements-backend.txt
curl -sSL https://install.python-poetry.org | python - --version 1.2.0rc1
poetry install --with dev,docs --all-extras
echo "PYTHONPATH=`pwd`" >> $GITHUB_ENV
- name: Autobump version
run: |
# from refs/tags/v1.2.3 get 1.2.3
Expand All @@ -46,7 +43,7 @@ jobs:
- name: Build docs
run: |
sudo apt-get update -y && sudo apt-get install -y pandoc
sphinx-build -b html -a docs docs/site
poetry run sphinx-build -b html -a docs docs/site
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
51 changes: 7 additions & 44 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,14 @@
FROM ubuntu:20.04

RUN apt-get update; DEBIAN_FRONTEND="noninteractive" apt-get install -y redis-server git python3-pip libgl1-mesa-glx libsm6 libxext6 libxrender-dev libglib2.0-0 pandoc
RUN apt-get update; DEBIAN_FRONTEND="noninteractive" apt-get install -y redis-server git python3-pip libgl1-mesa-glx libsm6 libxext6 libxrender-dev libglib2.0-0 pandoc curl

RUN ln -s /usr/bin/python3 /usr/bin/python
RUN pip install --upgrade pip

WORKDIR /home/service
COPY poetry.lock /platipy/poetry.lock
COPY pyproject.toml /platipy/pyproject.toml

COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

COPY requirements-dev.txt requirements-dev.txt
RUN pip install -r requirements-dev.txt

COPY requirements-backend.txt requirements-backend.txt
RUN pip install -r requirements-backend.txt

# COPY ./platipy platipy
# RUN pip install platipy

# TODO Revert to pypi version
RUN pip install git+https://github.com/pyplati/platipy.git

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENV PYTHONPATH "/home/service"

ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

ENV WORK C.UTF-8

ARG dicom_listen_port=7777

ENV DICOM_LISTEN_PORT ${dicom_listen_port}
ENV DICOM_LISTEN_AET PLATIPY_SERVICE

RUN printf '#!/bin/bash\npython3 -m platipy.backend.manage $@\n' > /usr/bin/manage && chmod +x /usr/bin/manage

EXPOSE 8000
EXPOSE ${dicom_listen_port}

ENV WORK /data
RUN mkdir /logs /data && chmod 0777 /logs /data

ENTRYPOINT ["/entrypoint.sh"]

CMD [ "manage" ]
RUN curl -sSL https://install.python-poetry.org | python - --version 1.2.0rc1
RUN echo 'export PATH="/root/.local/bin:$PATH"' >> ~/.bashrc
RUN /root/.local/bin/poetry config virtualenvs.create false
RUN env -C /platipy /root/.local/bin/poetry install --without dev,docs
3 changes: 3 additions & 0 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM platipy/platipy:service

RUN env -C /platipy /root/.local/bin/poetry install --with dev,docs --all-extras
36 changes: 36 additions & 0 deletions Dockerfile-service
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM platipy/platipy

RUN env -C /platipy /root/.local/bin/poetry install --with backend

RUN pip install platipy

# TODO Revert to pypi version
# RUN pip install git+https://github.com/pyplati/platipy.git

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENV PYTHONPATH "/home/service"

ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

ENV WORK C.UTF-8

ARG dicom_listen_port=7777

ENV DICOM_LISTEN_PORT ${dicom_listen_port}
ENV DICOM_LISTEN_AET PLATIPY_SERVICE

RUN printf '#!/bin/bash\npython3 -m platipy.backend.manage $@\n' > /usr/bin/manage && chmod +x /usr/bin/manage

EXPOSE 8000
EXPOSE ${dicom_listen_port}

ENV WORK /data
RUN mkdir /logs /data && chmod 0777 /logs /data

ENTRYPOINT ["/entrypoint.sh"]

CMD [ "manage" ]
2 changes: 1 addition & 1 deletion platipy/dicom/communication/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import os
import logging
import tempfile
import pydicom

Expand All @@ -36,7 +37,6 @@
)
from pynetdicom.pdu_primitives import SCP_SCU_RoleSelectionNegotiation

import logging
logger = logging.getLogger(__name__)


Expand Down

0 comments on commit f5d5004

Please sign in to comment.