Commit 2271e3f1 authored by James Kirk's avatar James Kirk
Browse files

refactor: updated how run_compose rebuilds and the container mount fs

parent 4b3816ce
FROM python:alpine3.17
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . .
ENTRYPOINT [ "python" ]
\ No newline at end of file
......@@ -19,7 +19,10 @@ services:
- rabbitmq__local
environment:
- MQ_HOST=rmq
volumes:
- ../:/app
command: "soar_bus.py"
container_name: soar_bus
soar_api:
build:
......@@ -35,5 +38,6 @@ services:
environment:
- MQ_HOST=rmq
volumes:
- ${DATA_DIR}/data:${DATA_DIR}/data
command: "api.py"
\ No newline at end of file
- ../:/app
command: "api.py"
container_name: soar_api
\ No newline at end of file
......@@ -10,7 +10,7 @@ class AuthResource(Resource):
def __init__(self):
self.token = TokenModel()
with open("/data/clients.json", "r") as clients_file:
with open("./data/clients.json", "r") as clients_file:
self.clients = json.load(clients_file)
def auth(self, request):
......
......@@ -13,7 +13,7 @@ class ClientSchema(Schema):
class ClientsFile:
file = "/data/clients.json"
file = "./data/clients.json"
mtime = 0
clients = {}
parser = None
......
......@@ -19,7 +19,7 @@ class Token(Resource):
self.schema = TokenQuerySchema()
self.model = TokenModel()
data_dir = os.getenv("DATA_DIR", "/data")
with open(data_dir + "/clients.json", "r") as clients_file:
with open("./data/clients.json", "r") as clients_file:
self.clients = json.load(clients_file)
def get(self):
......
......@@ -3,8 +3,26 @@
set -a
source .env
usage() {
echo "usage: ./run-compose.sh [<rebuild>]"
echo " rebuild - will force docker-compose to rebuild the images before spinning them up."
}
if [[ -z "${DATA_DIR}" ]]; then
DATA_DIR=$(pwd)
fi
docker-compose -f docker/docker-compose.yaml up --build
\ No newline at end of file
while [ -n "$1" ]; do
case $1 in
rebuild)
EXTRA_ARGS="--build"
;;
*)
usage
exit 0
;;
esac
shift
done
docker-compose -f docker/docker-compose.yaml up $EXTRA_ARGS
\ No newline at end of file
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