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