Added Docker setup for pyfiche services

Introduced a Dockerfile to containerize pyfiche alongside its dependencies. The setup includes the latest Python, installs pyfiche from a Git repository, and utilizes Supervisord for process management. Supervisord is configured to manage three pyfiche services: server, recup, and lines, ensuring they start on boot and restart on failure. Exposed ports allow external access, and a persistent data volume ensures data continuity. This encapsulates the pyfiche environment, providing a robust and consistent deployment method.
This commit is contained in:
Kumi 2024-01-22 09:18:32 +01:00
parent debe84737d
commit 23071d36f2
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 42 additions and 0 deletions

25
Dockerfile Normal file
View file

@ -0,0 +1,25 @@
FROM python:3.11
WORKDIR /usr/src/app
# Install pyfiche from the git repository
RUN pip install -U git+https://kumig.it/PrivateCoffee/pyfiche.git
# Install supervisord
RUN pip install supervisor
# Create a directory where pyfiche will store its data
RUN mkdir data
# Copy the supervisord configuration file into the container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Expose the ports that pyfiche, recup, and lines will run on
EXPOSE 9999
EXPOSE 9998
EXPOSE 9997
# Use VOLUME to allow data persistence
VOLUME ["/usr/src/app/data"]
# Run supervisord to manage the services
CMD ["/usr/local/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

17
supervisord.conf Normal file
View file

@ -0,0 +1,17 @@
[supervisord]
nodaemon=true
[program:pyfiche-server]
command=pyfiche-server -o /usr/src/app/data
autostart=true
autorestart=true
[program:pyfiche-recup]
command=pyfiche-recup -o /usr/src/app/data
autostart=true
autorestart=true
[program:pyfiche-lines]
command=pyfiche-lines -o /usr/src/app/data
autostart=true
autorestart=true