Skip to content

Commit

Permalink
Merge pull request #34 from bento-platform/features/dockerize
Browse files Browse the repository at this point in the history
v0.7.0 rc-1
  • Loading branch information
brouillette authored Dec 1, 2022
2 parents 4e9f390 + 6b18fef commit 4dd585d
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 2 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and push bento_drs

on:
release:
types: [ published ]
pull_request:
branches:
- master
push:
branches:
- master

jobs:
build-push:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Run Bento build action
uses: bento-platform/bento_build_action@v0.6
with:
registry: ghcr.io
registry-username: ${{ github.actor }}
registry-password: ${{ secrets.GITHUB_TOKEN }}
image-name: ghcr.io/bento-platform/bento_drs
development-dockerfile: dev.Dockerfile
dockerfile: Dockerfile
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ghcr.io/bento-platform/bento_base_image:python-debian-2022.10.11

# TODO: change USER
USER root

RUN apt install gcc libffi-dev -y

RUN echo "Building DRS in Production Mode";
WORKDIR /drs/bento_drs
RUN mkdir /wes && \
mkdir -p /drs/bento_drs/data/obj && \
mkdir -p /drs/bento_drs/data/db;
COPY requirements.txt requirements.txt
RUN ["pip", "install", "-r", "requirements.txt"]
COPY . .

# Run
WORKDIR /drs/bento_drs/chord_drs
COPY startup.sh ./startup.sh
CMD ["sh", "startup.sh"]
2 changes: 1 addition & 1 deletion chord_drs/package.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = chord_drs
version = 0.6.0
version = 0.7.0
authors = Simon Chénard, David Lougheed
author_emails = simon.chenard2@mcgill.ca, david.lougheed@mail.mcgill.ca
18 changes: 18 additions & 0 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ghcr.io/bento-platform/bento_base_image:python-debian-2022.10.11

# TODO: change USER
USER root

RUN apt install libffi-dev -y

RUN echo "Building DRS in Development Mode";
WORKDIR /drs/bento_drs
RUN mkdir /wes && \
mkdir -p /drs/bento_drs/data/obj && \
mkdir -p /drs/bento_drs/data/db;
COPY ./requirements.txt .
RUN ["pip", "install", "debugpy", "-r", "requirements.txt"]

# Run
WORKDIR /drs/bento_drs/chord_drs
COPY startup.sh ./startup.sh
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ flake8-polyfill==1.0.2
Flask==2.0.1
Flask-Migrate==3.1.0
Flask-SQLAlchemy==2.5.1
greenlet==1.0.0
greenlet==2.0.1
idna==2.10
iniconfig==1.1.1
itsdangerous==2.0.1
Expand Down
13 changes: 13 additions & 0 deletions startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cd ../data;
mkdir -p db;
mkdir -p obj;

cd ../chord_drs;
flask db upgrade;

# call variant endpoint to trigger init
cd ..;

# using 1 worker, multiple threads
# see https://stackoverflow.com/questions/38425620/gunicorn-workers-and-threads
gunicorn chord_drs.app:application -w 1 --threads $(expr 2 \* $(nproc --all) + 1) -b 0.0.0.0:5000

0 comments on commit 4dd585d

Please sign in to comment.