-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganizes files for consistency between repos. Completely refactors…
… Dockerfile to install from wheel.
- Loading branch information
Showing
14 changed files
with
353 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
__pycache__/ | ||
app.db | ||
static/.webassets-cache* | ||
static/*.css | ||
pb/static/*.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,48 @@ | ||
FROM python:3.7 | ||
|
||
ENV PATH=/root/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin | ||
|
||
# install node and yarn | ||
RUN apt-get update | ||
RUN apt-get -y install postgresql-client libpcre3 libpcre3-dev | ||
|
||
# config project dir | ||
RUN mkdir /protocol-builder-mock | ||
WORKDIR /protocol-builder-mock | ||
|
||
# install python requirements | ||
RUN pip install pipenv | ||
ADD Pipfile /protocol-builder-mock/ | ||
ADD Pipfile.lock /protocol-builder-mock/ | ||
RUN pipenv install --dev | ||
|
||
# include rejoiner code (gets overriden by local changes) | ||
COPY . /protocol-builder-mock/ | ||
|
||
ENV FLASK_APP=/protocol-builder-mock/app.py | ||
|
||
# run webserver by default | ||
CMD ["pipenv", "run", "python", "/protocol-builder-mock/run.py"] | ||
|
||
# expose ports | ||
EXPOSE 5001 | ||
|
||
|
||
# | ||
# https://medium.com/@greut/building-a-python-package-a-docker-image-using-pipenv-233d8793b6cc | ||
# https://github.com/greut/pipenv-to-wheel | ||
# | ||
FROM kennethreitz/pipenv as pipenv | ||
|
||
ADD . /app | ||
WORKDIR /app | ||
|
||
RUN pipenv install --dev \ | ||
&& pipenv lock -r > requirements.txt \ | ||
&& pipenv run python setup.py bdist_wheel | ||
|
||
# ---------------------------------------------------------------------------- | ||
FROM ubuntu:bionic | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
COPY --from=pipenv /app/dist/*.whl . | ||
|
||
RUN set -xe \ | ||
&& apt-get update -q \ | ||
&& apt-get install -y -q \ | ||
python3-minimal \ | ||
python3-wheel \ | ||
python3-pip \ | ||
gunicorn3 \ | ||
postgresql-client \ | ||
&& python3 -m pip install *.whl \ | ||
&& apt-get remove -y python3-pip python3-wheel \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -f *.whl \ | ||
&& rm -rf /root/.cache \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& mkdir -p /app \ | ||
&& useradd _gunicorn --no-create-home --user-group | ||
|
||
USER _gunicorn | ||
|
||
COPY ./static /app/static | ||
COPY ./docker_run.sh /app/ | ||
COPY ./wait-for-it.sh /app/ | ||
WORKDIR /app | ||
|
||
CMD ["gunicorn3", \ | ||
"--bind", "0.0.0.0:8000", \ | ||
"pb:app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ url = "https://pypi.org/simple" | |
verify_ssl = true | ||
|
||
[dev-packages] | ||
pbr = "*" | ||
|
||
[packages] | ||
flask = "*" | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from sqlalchemy import func | ||
from app import db, ma | ||
from pb import db, ma | ||
|
||
|
||
class Study(db.Model): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from app import app | ||
from pb import app | ||
if __name__ == "__main__": | ||
flask_port = app.config['FLASK_PORT'] | ||
app.run(host='0.0.0.0', port=flask_port) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[metadata] | ||
name = pb | ||
|
||
[files] | ||
packages = pb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from setuptools import setup | ||
|
||
setup(setup_requires=["pbr"], pbr=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
.mat-icon { | ||
font-family: 'Material Icons', sans-serif; | ||
font-size: 24px; } | ||
|
||
.text-center { | ||
text-align: center; } | ||
|
||
html, body { | ||
padding: 1em; | ||
margin: 0; | ||
font-family: Arial, sans-serif; | ||
font-size: 16px; } | ||
|
||
table { | ||
border: 1px solid #cacaca; | ||
background-color: white; | ||
width: 100%; | ||
text-align: left; | ||
border-collapse: collapse; } | ||
table th, table td { | ||
padding: 0.5em; } | ||
table td, table.blueTable th { | ||
border: 1px solid #cacaca; } | ||
table tbody td { | ||
font-size: 14px; } | ||
table tr:nth-child(even) { | ||
background: #ededed; } | ||
table thead { | ||
background-color: #495e9d; } | ||
table thead th { | ||
font-size: 16px; | ||
font-weight: bold; | ||
color: white; | ||
border-left: 1px solid #cacaca; } | ||
table thead th:first-child { | ||
border-left: none; } | ||
table tfoot { | ||
font-size: 16px; | ||
font-weight: bold; | ||
color: white; | ||
background-color: #cacaca; } | ||
table tfoot td { | ||
font-size: 16px; } | ||
table tfoot .links { | ||
text-align: right; } | ||
table tfoot .links a { | ||
display: inline-block; | ||
background: #495e9d; | ||
color: white; | ||
padding: 2px 8px; | ||
border-radius: 5px; } | ||
|
||
.btn { | ||
font-size: 16px; | ||
padding: 0.5em 1em; | ||
border-radius: 5px; | ||
text-decoration: none; | ||
color: white; | ||
white-space: nowrap; | ||
border: none; } | ||
.btn:hover { | ||
text-decoration: none; } | ||
.btn.btn-icon { | ||
font-family: 'Material Icons', sans-serif; | ||
font-size: 24px; | ||
border: none; } | ||
.btn.btn-icon.btn-default { | ||
color: #4e4e4e; | ||
background-color: transparent; | ||
border: none; } | ||
.btn.btn-icon.btn-default:hover { | ||
color: #373737; | ||
background-color: transparent; } | ||
.btn.btn-icon.btn-primary { | ||
color: #232D4B; | ||
background-color: transparent; } | ||
.btn.btn-icon.btn-primary:hover { | ||
color: #191f34; | ||
background-color: transparent; } | ||
.btn.btn-icon.btn-accent { | ||
color: #E57200; | ||
background-color: transparent; } | ||
.btn.btn-icon.btn-accent:hover { | ||
color: #a05000; | ||
background-color: transparent; } | ||
.btn.btn-icon.btn-warn { | ||
color: #DF1E43; | ||
background-color: transparent; } | ||
.btn.btn-icon.btn-warn:hover { | ||
color: #9c152f; | ||
background-color: transparent; } | ||
.btn.btn-default { | ||
color: #373737; | ||
background-color: white; | ||
border: 1px solid #cacaca; } | ||
.btn.btn-default:hover { | ||
background-color: #ededed; } | ||
.btn.btn-primary { | ||
background-color: #232D4B; } | ||
.btn.btn-primary:hover { | ||
background-color: #191f34; } | ||
.btn.btn-warn { | ||
background-color: #DF1E43; } | ||
.btn.btn-warn:hover { | ||
background-color: #9c152f; } | ||
.btn.btn-accent { | ||
background-color: #E57200; } | ||
.btn.btn-accent:hover { | ||
background-color: #a05000; } | ||
|
||
select.multi { | ||
height: 600px; } | ||
|
||
.form-field { | ||
display: flex; | ||
width: 100%; | ||
margin-bottom: 40px; | ||
padding: 2em; } | ||
.form-field:nth-child(even) { | ||
background-color: #ededed; } | ||
.form-field .form-field-label, .form-field .form-field-help, | ||
.form-field .form-field-input { | ||
width: 30%; | ||
text-align: left; | ||
margin-right: 40px; } | ||
.form-field .form-field-label { | ||
font-weight: bold; } | ||
.form-field .form-field-input input { | ||
width: 100%; } | ||
.form-field .form-field-help { | ||
font-style: italic; } | ||
.form-field .form-field-error { | ||
color: #DF1E43; } |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters