diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..60f2820 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM python:3.6.12-alpine3.12 +WORKDIR /usr/src/ics + +# Copy the actual folder and install dependencies + +COPY . ./ +RUN pip3 install -r requirements.txt + +# Mount the config volume + +RUN mkdir /usr/src/ics/app/config +VOLUME [ "/usr/src/ics/app/config" ] + +EXPOSE 8088 + +CMD ["python3", "./app/server.py"] + diff --git a/README.md b/README.md index f32d1f2..259cab8 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,22 @@ ICS Fusion is written in Python and using `Flask` to provide the HTTP endpoint. Launch the `app/server.py` file to start the application. +### Building the image +ICS Fusion can be built as a Docker image. To do so, type : + +`docker build --tag ics-fusion:1.0 .` + +in the main folder of Fusion ICS. + +### Running the container +To run the container, type: + +`docker run --publish PORT:8088 --detach --name ics --volume DIRECTORY:/usr/src/ics/app/config ics-fusion:1.0` + +Where: +* `PORT` is the port you want to expose on your host machine. +* `DIRECTORY` is the path to your config directory. + ## Configuration To create a new feed in the application, create a file with the `.json` extension in the `app/config` folder. The name of the configuration file will be used to create a new endpoint to serve the feed. diff --git a/app/server.py b/app/server.py index a801145..ba2a94d 100644 --- a/app/server.py +++ b/app/server.py @@ -1,7 +1,7 @@ from flask import Flask, make_response -from app.tools.caching import CacheThread -from app.tools.tools import * +from tools.caching import CacheThread +from tools.tools import * app = Flask(__name__) diff --git a/app/tools/tools.py b/app/tools/tools.py index bdff209..e5f29fd 100644 --- a/app/tools/tools.py +++ b/app/tools/tools.py @@ -77,7 +77,7 @@ from typing import List from ics import Calendar from pathvalidate import sanitize_filename -from app.tools.caching import load_cal +from tools.caching import load_cal def filtering(cal: Calendar, filters: dict, field_name: str) -> Calendar: