1
0
Fork 0

Refactor Dockerfile for multi-stage build and runtime optimization

- Implemented a two-stage Dockerfile: build environment with Python dependencies and lean runtime stage with HAProxy.
- Added custom entrypoint script for dynamic Docker group adjustment.
- Improved HAProxy command generation by introducing a static method for binary resolution.
- Updated tests and functional logic to dynamically resolve the `haproxy` binary path.
- Adjusted file permissions in E2E key generation script for better security.
- Streamlined `.gitignore` by removing unnecessary exclusions.
This commit is contained in:
Joao Gilberto Magalhaes 2026-02-18 01:53:27 -05:00
parent bfd38adea5
commit 44cb3dd5e0
7 changed files with 65 additions and 77 deletions

View file

@ -354,8 +354,12 @@ class DaemonizeHAProxy:
self.thread = Process(target=self.__start, args=())
self.thread.start()
@staticmethod
def get_haproxy_bin() -> str:
return shutil.which('haproxy') or '/usr/sbin/haproxy'
def get_haproxy_command(self, action, pid_file="/run/haproxy.pid"):
haproxy_bin = shutil.which('haproxy') or '/usr/sbin/haproxy'
haproxy_bin = DaemonizeHAProxy.get_haproxy_bin()
custom_config_files = ""
if len(list(self.get_custom_config_files().keys())) != 0:
custom_config_files = f"-f {self.custom_config_folder}"