Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3764710
D2720.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D2720.diff
View Options
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,39 @@
+# -------------------------------------------------------------
+# Nasqueron API - Clean URL API image
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: BSD-2-Clause
+# -------------------------------------------------------------
+
+# -------------------------------------------------------------
+# Build dependencies
+#
+# As uWSGI requires gcc, build in a full Debian image.
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+FROM python:3.11 AS builder
+
+MAINTAINER Sébastien Santoro aka Dereckson <dereckson+nasqueron-docker@espace-win.org>
+
+WORKDIR /srv/api
+COPY requirements.txt .
+
+RUN python -m venv --copies /srv/api/venv && \
+ /srv/api/venv/bin/pip install --no-cache-dir -r requirements.txt
+
+# -------------------------------------------------------------
+# Run image
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+FROM python:3.11-slim
+
+RUN apt update && apt install -y libxml2 && rm -rf /var/lib/apt/lists/*
+
+WORKDIR /srv/api
+COPY --from=builder /srv/api/venv /srv/api/venv/
+COPY . ./
+
+EXPOSE 8000
+
+ENV PATH /srv/api/venv/bin:$PATH
+CMD ["uwsgi", "--yaml", "config.yml"]
diff --git a/config.yml b/config.yml
new file mode 100644
--- /dev/null
+++ b/config.yml
@@ -0,0 +1,14 @@
+uwsgi:
+ module: server:app
+
+ master: True
+ uid: nobody
+
+ processes: 3
+ threads: 10
+ enable-threads: True
+ thunder-lock: True
+
+ die-on-term: true
+
+ http-socket: :8000
diff --git a/requirements.txt b/requirements.txt
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,3 @@
Flask>=2.2.2
requests>=2.28.1
+uWSGI>=2.0.21
diff --git a/server.py b/server.py
new file mode 100644
--- /dev/null
+++ b/server.py
@@ -0,0 +1,11 @@
+from clean import app
+
+
+# -------------------------------------------------------------
+# WSGI entry point
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+if __name__ == "__main__":
+ app.run()
+
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 07:46 (17 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2257517
Default Alt Text
D2720.diff (2 KB)
Attached To
Mode
D2720: Run with uWSGI on Docker
Attached
Detach File
Event Timeline
Log In to Comment