Begin Management in Docker
All checks were successful
Build and push Docker image at git tag / build (push) Successful in 26m48s
All checks were successful
Build and push Docker image at git tag / build (push) Successful in 26m48s
This commit is contained in:
50
docker-mgmt/Dockerfile
Normal file
50
docker-mgmt/Dockerfile
Normal file
@ -0,0 +1,50 @@
|
||||
FROM ubuntu:24.04
|
||||
|
||||
ARG H_GID
|
||||
ARG H_UID
|
||||
ARG PIP_REQ_FILE
|
||||
|
||||
RUN apt update && \
|
||||
apt install -y bash \
|
||||
build-essential \
|
||||
git \
|
||||
curl \
|
||||
ca-certificates \
|
||||
python3-dev \
|
||||
python3-pip
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive TZ=Europe/Berlin apt-get install -y tzdata \
|
||||
&& cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime \
|
||||
&& echo "Europe/Berlin" > /etc/timezone
|
||||
|
||||
RUN apt-get install -y vim htop \
|
||||
nginx supervisor \
|
||||
&& rm -rf /var/lib/apt/lists
|
||||
|
||||
# sytem and user setup
|
||||
RUN ln -s /usr/bin/python3 /usr/local/bin/python \
|
||||
&& addgroup --gid $H_GID user \
|
||||
&& adduser user --uid $H_UID --ingroup user --gecos "" --home /home/user/ --disabled-password
|
||||
|
||||
RUN mkdir -p /ums-agenten/plattform/
|
||||
|
||||
COPY ./docker-mgmt/$PIP_REQ_FILE /ums-agenten/requirements.txt
|
||||
RUN pip3 install --break-system-packages --no-cache-dir -r /ums-agenten/requirements.txt \
|
||||
&& pip3 freeze > /ums-agenten/requirements.txt
|
||||
|
||||
# nginx settings and startup
|
||||
COPY ./docker-mgmt/supervisor.conf /etc/supervisor/supervisord.conf
|
||||
COPY ./docker-mgmt/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY ./docker-mgmt/app.conf /etc/nginx/sites-enabled/default
|
||||
|
||||
# install the code of the repo
|
||||
COPY ./docker-mgmt/setup.py /ums-agenten/plattform/
|
||||
RUN pip3 install --break-system-packages -e /ums-agenten/plattform/
|
||||
|
||||
WORKDIR /ums-agenten/plattform/ums/
|
||||
|
||||
COPY --chown=user:user ./ums/ /ums-agenten/plattform/ums/
|
||||
COPY --chown=user:user ./web/ /ums-agenten/plattform/web/
|
||||
|
||||
# run nginx and uvicorn
|
||||
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|
27
docker-mgmt/app.conf
Normal file
27
docker-mgmt/app.conf
Normal file
@ -0,0 +1,27 @@
|
||||
server {
|
||||
|
||||
listen 80 default_server;
|
||||
|
||||
server_name _;
|
||||
|
||||
root /ums-agenten/plattform/web/public/;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ @dynamic;
|
||||
}
|
||||
|
||||
location @dynamic {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
proxy_redirect off;
|
||||
proxy_buffering off;
|
||||
|
||||
proxy_pass http://unix:/tmp/uvicorn.sock;
|
||||
}
|
||||
|
||||
}
|
47
docker-mgmt/nginx.conf
Normal file
47
docker-mgmt/nginx.conf
Normal file
@ -0,0 +1,47 @@
|
||||
user user;
|
||||
worker_processes auto;
|
||||
pid /run/nginx.pid;
|
||||
include /etc/nginx/modules-enabled/*.conf;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
##
|
||||
# Basic Settings
|
||||
##
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
server_tokens off;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
##
|
||||
# SSL Settings
|
||||
##
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
##
|
||||
# Logging Settings
|
||||
##
|
||||
access_log off;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
##
|
||||
# Gzip Settings
|
||||
##
|
||||
gzip on;
|
||||
|
||||
##
|
||||
# Virtual Host Configs
|
||||
##
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
}
|
31
docker-mgmt/requirements-frozen.txt
Normal file
31
docker-mgmt/requirements-frozen.txt
Normal file
@ -0,0 +1,31 @@
|
||||
annotated-types==0.7.0
|
||||
anyio==4.6.0
|
||||
certifi==2024.8.30
|
||||
charset-normalizer==3.3.2
|
||||
click==8.1.7
|
||||
fastapi==0.115.0
|
||||
h11==0.14.0
|
||||
httptools==0.6.1
|
||||
idna==3.10
|
||||
Jinja2==3.1.4
|
||||
MarkupSafe==2.1.5
|
||||
pdoc==14.7.0
|
||||
pydantic==2.9.2
|
||||
pydantic_core==2.23.4
|
||||
Pygments==2.18.0
|
||||
python-dotenv==1.0.1
|
||||
python-multipart==0.0.12
|
||||
PyYAML==6.0.2
|
||||
requests==2.32.3
|
||||
setuptools==68.1.2
|
||||
sniffio==1.3.1
|
||||
starlette==0.38.6
|
||||
supervisor==4.2.5
|
||||
tqdm==4.66.5
|
||||
typing_extensions==4.12.2
|
||||
urllib3==2.2.3
|
||||
uvicorn==0.31.0
|
||||
uvloop==0.20.0
|
||||
watchfiles==0.24.0
|
||||
websockets==13.1
|
||||
wheel==0.42.0
|
7
docker-mgmt/requirements.txt
Normal file
7
docker-mgmt/requirements.txt
Normal file
@ -0,0 +1,7 @@
|
||||
# non frozen dependecies, to use latest
|
||||
requests
|
||||
tqdm
|
||||
pdoc
|
||||
fastapi
|
||||
uvicorn[standard]
|
||||
python-multipart
|
9
docker-mgmt/setup.py
Normal file
9
docker-mgmt/setup.py
Normal file
@ -0,0 +1,9 @@
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
setup(
|
||||
name='ums',
|
||||
packages=find_packages(),
|
||||
version='0.0.0',
|
||||
description='UMS-Agenten',
|
||||
author='Magnus Bender',
|
||||
)
|
25
docker-mgmt/supervisor.conf
Normal file
25
docker-mgmt/supervisor.conf
Normal file
@ -0,0 +1,25 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
|
||||
[program:setup]
|
||||
command=/bin/sh -c "chown user:user -R /ums-agenten"
|
||||
user=root
|
||||
autostart=true
|
||||
autorestart=false
|
||||
|
||||
[fcgi-program:uvicorn]
|
||||
socket=unix:///tmp/uvicorn.sock
|
||||
command=/usr/local/bin/uvicorn ums.management.main:app --uds /tmp/uvicorn.sock --proxy-headers
|
||||
numprocs=4
|
||||
process_name=uvicorn-%(process_num)d
|
||||
user=user
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=10
|
||||
|
||||
[program:nginx]
|
||||
command=/usr/sbin/nginx -g 'daemon off;'
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=20
|
Reference in New Issue
Block a user