Commit b2a545e4 authored by Nicholas J Anderson's avatar Nicholas J Anderson

Python3 support, Docker image, CI builds

parent bec61ca7
stages:
- build
build:
stage: build
retry: 2
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE/api:$CI_COMMIT_TAG
only:
- tags
FROM python:3
COPY mason-today /usr/local/mason-today
COPY requirements.txt /usr/local/mason-today/requirements.txt
RUN pip install --no-cache-dir -r /usr/local/mason-today/requirements.txt
WORKDIR /usr/local/mason-today
ENV PYTHONPATH=/usr/local/mason-today/__init__.py
ENV FLASK_APP=mason-today
ENV FLASK_DEBUG=0
CMD [ "flask", "run" ]
---
version: '3.7'
network:
front:
back:
internal: yes
service:
api:
image: registry.srct.gmu.edu/srct/mason-today-web/api:latest
environment:
FLASK_DEBUG: 0
REDIS_HOST: db
network:
front:
back:
db:
image: redis
network:
back:
......@@ -10,7 +10,6 @@ from multiprocessing import Process
# python imports
import json
import thread
# other imports
import redis
......@@ -57,7 +56,7 @@ try:
except Exception as e:
print(e)
print "===================================================" \
print("===================================================" \
+ "Unable to start scheduling thread" \
+ traceback.print_exc(file=sys.stdout) \
+ "==================================================="
\ No newline at end of file
+ "===================================================")
......@@ -262,7 +262,7 @@ def load_data():
del location[-1]
else:
location = [location]
except Exception:
except Exception as e:
error.append("Location Error: " + str(e))
try:
......
......@@ -17,7 +17,10 @@ import redis
# setting up redis database
redisdb = redis.from_url("redis://localhost:6379/0", db=0)
redis_host = os.environ.get("REDIS_HOST", "localhost")
redis_port = os.environ.get("REDIS_PORT", "6379")
redisdb = redis.from_url("redis://{0}:{1}/0".format(redis_host, redis_port), db=0)
# this will update the live dictlist and the cachedate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment