3 Commits

Author SHA1 Message Date
Piero Toffanin
00d01a99d7 Set HOME in docker images 2025-12-10 11:22:14 -05:00
Peter Dave Hello
86f7cd00a1 Update Docker Python base images to 3.11.14 bookworm
Switch Docker base images to Python v3.11.14 slim-bookworm because the
official Python images no longer ship slim-bullseye. Keeps Python
3.11.12-3.11.14 security fixes (libexpat, tarfile filters, zip64,
setuptools CVEs) on a supported Debian base.

Refs:
- https://www.python.org/downloads/release/python-31114/
- https://www.python.org/downloads/release/python-31113/
- https://www.python.org/downloads/release/python-31112/
2025-12-10 01:14:37 +08:00
Warren R. Bank
01042ab2bd Add 2 variations of Dockerfile
1. docker/root-with-sshd.Dockerfile
   - executes as user: "root"
   - supports build arguments:
     * api_key
     * root_password

2. docker/user-with-api-key.Dockerfile
   - executes as user: "libretranslate"
   - supports build arguments:
     * api_key

Build arguments are optional:

* api_key=""
  - initializes one API key with the user-defined value

* root_password=""
  - sets password for "root" user
  - installs sshd server to allow remote access to "ltmanage" command
    * enables "PermitRootLogin"
    * enables "PasswordAuthentication"

Environment variables with complimentary behavior:

* LT_REQ_LIMIT = 0
* LT_API_KEYS  = true
  - locks down server and requires an API key for all API access

Testing:

* unexpected complications
  - sudo:
    * error message:
        effective uid is not 0,
        is /usr/bin/sudo on a file system with the 'nosuid' option set
        or an NFS file system without root privileges?
    * info:
        https://unix.stackexchange.com/q/546822
    * result:
      - discarded Dockerfile variation that attempted to:
        * run entrypoint as user: "libretranslate"
        * use sudo to run sshd

* "render.com" free tier
  - notes:
    * completely free
    * no credit card required
    * can clone any public git repo and run any Dockerfile it contains
    * can NOT use SSH to access containers
  - Dockerfile variations:
    1. docker/Dockerfile
       - works perfectly
       - public API is open and unrestricted
    2. docker/root-with-sshd.Dockerfile
       - works perfectly
       - public API is only accessible to requests with "api_key"
       - SSH server is running
         * public access is blocked by container firewall
         * haven't tested on a paid tier,
           but external connections should be allowed and work
    3. docker/user-with-api-key.Dockerfile
       - works perfectly
       - public API is only accessible to requests with "api_key"
2025-04-22 14:35:07 -07:00