diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2f3bc82 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.11-slim +WORKDIR /paste +COPY requirements.txt requirements.txt +COPY paste ${WORKDIR} + +RUN apt update && apt install -y wget && apt -y clean +RUN pip install -r requirements.txt + +EXPOSE 5000 + +CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"] \ No newline at end of file diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml new file mode 100644 index 0000000..df41403 --- /dev/null +++ b/docker-compose-dev.yml @@ -0,0 +1,13 @@ +services: + paste: + build: . + ports: + - "5000:5000" + environment: + PASTE_REDIS_HOST: "redis" + healthcheck: + test: [ 'CMD', 'wget', '-q', '--spider', 'http://localhost/health'] + redis: + image: "redis:7.0" + healthcheck: + test: [ 'CMD', 'redis-cli', 'ping' ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a4bb79e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +services: + paste: + build: git.gnous.eu/gnouseu/paste + ports: + - "5000:5000" + environment: + PASTE_REDIS_HOST: "redis" + healthcheck: + test: [ 'CMD', 'wget', '-q', '--spider', 'http://localhost/health'] + redis: + image: "redis:7.0" + healthcheck: + test: [ 'CMD', 'redis-cli', 'ping' ] diff --git a/paste/home.py b/paste/home.py index 939b64b..5aa0b8a 100755 --- a/paste/home.py +++ b/paste/home.py @@ -87,3 +87,12 @@ def get_content(path: str) -> str: return render_template("content.html.j2") return abort(404) + + +@home.route("/check") +def health_check() -> str: + """ + For verify if the app run. + :return: "ok". + """ + return "ok"