Commit 1ae6b98f authored by Raphael Beer's avatar Raphael Beer

Merge branch 'feat/docker' into dev

parents ab88423f ff3c6202
......@@ -3,9 +3,8 @@ COOKIE_DIR=./.htcookies
LOG_FILE=./logs/results.log
DEBUG_FILE=./logs/debug.log
PORT=4040
HOST=127.0.0.1
MONGO_HOST=127.0.0.1
MONGO_PORT=27017
MONGO_DB=tester
MONGO_RESULTS_COLLECTION=results
MONGO_OVERSHOT_COLLECTION=overshot
TWITTER_AUTH_KEY=GRAPHQL_KEY
FROM python:3.5.7-slim-buster
RUN mkdir /app
WORKDIR /app
ADD requirements.txt /app/
ADD . /app
RUN pip3 install --no-cache-dir -r ./requirements.txt
......@@ -531,6 +531,7 @@ parser.add_argument('--log', type=str, default=None, help='log file where test r
parser.add_argument('--daemon', action='store_true', help='run in background')
parser.add_argument('--debug', type=str, default=None, help='debug log file')
parser.add_argument('--port', type=int, default=8080, help='port which to listen on')
parser.add_argument('--host', type=str, default='127.0.0.1', help='hostname/ip which to listen on')
parser.add_argument('--mongo-host', type=str, default='localhost', help='hostname or IP of mongoDB service to connect to')
parser.add_argument('--mongo-port', type=int, default=27017, help='port of mongoDB service to connect to')
parser.add_argument('--mongo-db', type=str, default='tester', help='name of mongo database to use')
......@@ -563,7 +564,7 @@ def run():
loop.run_until_complete(login_guests())
app = web.Application()
app.add_routes(routes)
web.run_app(app, host='127.0.0.1', port=args.port)
web.run_app(app, host=args.host, port=args.port)
if args.daemon:
with daemon.DaemonContext():
......
version: "3.5"
services:
tester:
command: ["bash", "./run.sh", "development"]
version: "3.5"
services:
tester:
build: .
command: ["bash", "./docker-entry.sh"]
env_file: ${EXPECTED_ENV_FILE}
ports:
- "127.0.0.1:${PORT}:${PORT}"
volumes:
- .:/app
networks:
- mongodb
networks:
mongodb:
external:
name: shadowban-eu_mongodb
#/usr/bin/env bash
echo "Starting server..."
echo "--account-file $ACCOUNT_FILE"
echo "--cookie-dir $COOKIE_DIR"
echo "--log $LOG_FILE"
echo "--debug $DEBUG_FILE"
echo "--port "$PORT""
echo "--host "$HOST""
echo "--mongo-host $MONGO_HOST"
echo "--mongo-port $MONGO_PORT"
echo "--mongo-db $MONGO_DB"
echo "--twitter-auth-key $TWITTER_AUTH_KEY"
python3 -u ./backend.py \
--account-file $ACCOUNT_FILE \
--cookie-dir $COOKIE_DIR \
--log $LOG_FILE \
--debug $DEBUG_FILE \
--port "$PORT" \
--host "$HOST" \
--mongo-host $MONGO_HOST \
--mongo-port $MONGO_PORT \
--mongo-db $MONGO_DB \
--twitter-auth-key $TWITTER_AUTH_KEY
......@@ -13,15 +13,6 @@ if [ ! -f $EXPECTED_ENV_FILE ]; then
fi
echo "Using configuration from: $EXPECTED_ENV_FILE"
source $EXPECTED_ENV_FILE
echo "Listening on: $PORT"
echo "Starting server..."
python3 ./backend.py \
--account-file $ACCOUNT_FILE \
--cookie-dir $COOKIE_DIR \
--log $LOG_FILE \
--debug $DEBUG_FILE \
--port "$PORT" \
--mongo-host $MONGO_HOST \
--mongo-port $MONGO_PORT \
--mongo-db $MONGO_DB \
--twitter-auth-key $TWITTER_AUTH_KEY
PORT=$PORT EXPECTED_ENV_FILE=$EXPECTED_ENV_FILE docker-compose -f docker-compose.yml up
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