From b5d2b86548b48916eb8bbf11a5aa4f66ee56e72e Mon Sep 17 00:00:00 2001
From: Empiriker <till.ueberfries@gmail.com>
Date: Fri, 8 Sep 2023 14:18:15 +0200
Subject: [PATCH] containerize application

---
 .dockerignore       |  3 +++
 Dockerfile          | 18 ++++++++++++++++++
 docker-compose.yaml | 17 +++++++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 .dockerignore
 create mode 100644 Dockerfile
 create mode 100644 docker-compose.yaml

diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..1195bf4
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,3 @@
+__pycache__
+apicache-py3
+throttle.ctrl
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..08ee85f
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,18 @@
+FROM python:3.11-bullseye
+WORKDIR /app
+COPY requirements.txt /app/
+RUN pip install --no-cache-dir -r requirements.txt
+# Install git
+RUN apt-get update && apt-get install -y git
+# Install wiktextract
+RUN git clone https://github.com/tatuylonen/wiktextract.git && \
+  cd wiktextract && \
+  git checkout 205c4a2d88c27113f0117e0095f466605976af81 && \
+  python -m pip install --use-pep517 .
+# Uninstall git, remove temporary files and package lists
+RUN apt-get purge -y git && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/*
+COPY /src/. ./src/
+EXPOSE 80
+# Set Flask environment variables
+ENV FLASK_APP=/src/app.py
+CMD ["flask", "run", "--debug"]
diff --git a/docker-compose.yaml b/docker-compose.yaml
new file mode 100644
index 0000000..8736c2e
--- /dev/null
+++ b/docker-compose.yaml
@@ -0,0 +1,17 @@
+version: '3'
+services:
+  web:
+    build: 
+      context: .
+      network: host
+      dockerfile: Dockerfile
+    environment:
+      FLASK_DEBUG: "on"
+      FLASK_APP: ./src/app.py
+    ports:
+      - "5000:80"
+    x-develop:
+      watch:
+        - action: sync
+          path: ./src
+          target: /src/
\ No newline at end of file
-- 
GitLab