mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
Load environment variables in container. So the python-dotenv module is no longer needed!
This commit is contained in:
parent
0f0c40951b
commit
e3db2ecd1e
38
Dockerfile
38
Dockerfile
@ -1,18 +1,30 @@
|
|||||||
# pull official base image
|
FROM python:3.6-alpine
|
||||||
FROM python:3.6.9
|
|
||||||
|
|
||||||
# set environment varibles
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE 1
|
|
||||||
ENV PYTHONUNBUFFERED 1
|
|
||||||
|
|
||||||
# set work directory
|
RUN apk add build-base
|
||||||
WORKDIR /opaque
|
|
||||||
|
|
||||||
# Copy the current directory contents into the container at /daemon
|
|
||||||
COPY . /opaque
|
|
||||||
|
|
||||||
# Install requirements
|
RUN adduser -D opaque
|
||||||
RUN pip install --trusted-host pypi.python.org -r requirements.txt
|
USER opaque
|
||||||
|
|
||||||
# set permissions for entrypoint
|
|
||||||
RUN chmod a+x flask-entrypoint.sh
|
WORKDIR /home/opaque
|
||||||
|
|
||||||
|
|
||||||
|
COPY app app
|
||||||
|
COPY migrations migrations
|
||||||
|
COPY opaque.py config.py ./
|
||||||
|
COPY requirements.txt requirements.txt
|
||||||
|
|
||||||
|
|
||||||
|
RUN python -m venv venv && \
|
||||||
|
venv/bin/pip install -r requirements.txt
|
||||||
|
|
||||||
|
|
||||||
|
COPY docker-entrypoint.sh /usr/local/bin/
|
||||||
|
|
||||||
|
|
||||||
|
EXPOSE 5000
|
||||||
|
|
||||||
|
|
||||||
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||||
|
13
docker-entrypoint.sh
Executable file
13
docker-entrypoint.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# If no argument is given, start Opaque
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then
|
||||||
|
venv/bin/python opaque.py
|
||||||
|
else
|
||||||
|
if [[ $1 == "--create-db" ]]
|
||||||
|
then
|
||||||
|
flask db init
|
||||||
|
flask db upgrade
|
||||||
|
fi
|
||||||
|
fi
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash -x
|
|
||||||
|
|
||||||
python opaque.py
|
|
@ -1,7 +1,5 @@
|
|||||||
import eventlet
|
import eventlet
|
||||||
eventlet.monkey_patch()
|
eventlet.monkey_patch()
|
||||||
from dotenv import load_dotenv
|
|
||||||
load_dotenv()
|
|
||||||
from app import create_app, db, socketio
|
from app import create_app, db, socketio
|
||||||
from app.models import Corpus, User, Role, Permission, Job
|
from app.models import Corpus, User, Role, Permission, Job
|
||||||
from flask_migrate import Migrate
|
from flask_migrate import Migrate
|
||||||
|
@ -8,5 +8,4 @@ Flask-SQLAlchemy
|
|||||||
Flask-Table
|
Flask-Table
|
||||||
Flask-WTF
|
Flask-WTF
|
||||||
jsonpatch
|
jsonpatch
|
||||||
python-dotenv
|
|
||||||
redis
|
redis
|
||||||
|
Loading…
Reference in New Issue
Block a user