~metalune/simplytranslate-devel

Fix and clean the Docker deployment v1 APPLIED

: 1
 Fix and clean the Docker deployment

 4 files changed, 34 insertions(+), 11 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~metalune/simplytranslate-devel/patches/28411/mbox | git am -3
Learn more about email & git

[PATCH] Fix and clean the Docker deployment Export this patch

From: Austin Huang <im@austinhuang.me>

Co-authored-by: TheFrenchGhosty <TheFrenchGhosty@posteo.is>
---
 web/Dockerfile         |  5 ++---
 web/config.conf        | 27 +++++++++++++++++++++++++++
 web/docker-compose.yml | 11 ++++-------
 web/uvicorn/Dockerfile |  2 +-
 4 files changed, 34 insertions(+), 11 deletions(-)
 create mode 100644 web/config.conf

diff --git a/web/Dockerfile b/web/Dockerfile
index 31b22cf..16cc0e6 100644
--- a/web/Dockerfile
+++ b/web/Dockerfile
@@ -1,6 +1,6 @@
FROM python:3-slim

RUN apt update && apt upgrade && apt install -y git
RUN apt update && apt upgrade && apt install -y git automake libtool g++-multilib-i686-linux-gnu zlib1g-dev  build-essential gcc g++ libxml2 libxml2-dev libxslt1.1 libxslt1-dev

RUN git clone https://git.sr.ht/~metalune/simplytranslate_engines engines && \
    git clone https://git.sr.ht/~metalune/simplytranslate_web web
@@ -9,8 +9,7 @@ WORKDIR /engines
RUN python3 setup.py install && \
    pip install -r requirements.txt
WORKDIR /web
RUN pip install -r requirements.txt && \
    pip install uvicorn
RUN pip install -r requirements.txt

EXPOSE 5000
CMD ["python3", "main.py"]
diff --git a/web/config.conf b/web/config.conf
new file mode 100644
index 0000000..dc16f48
--- /dev/null
+++ b/web/config.conf
@@ -0,0 +1,27 @@
# This is an example configuration file. It can be either
# /etc/simplytranslate/web.conf or /etc/simplytranslate/shared.conf (this one
# is also used by other frontends, like the Gemini frontend). In case of
# duplicate keys between files, the key in `gemini.conf` takes precedence.

[libre]
# LibreTranslate is disabled by default. If it is enabled, `Instance` is required.
Enabled = False
Instance = https://libretranslate.com
# Not all instances need an API key; if the one you use don't, remove this
# line.
ApiKey = [REDACTED]

[google]
# Google translate is enabled by default.
Enabled = True

[deepl]
Enabled = False

[iciba]
# ICIBA Translate (a.k.a. PowerWord) is disabled by default.
Enabled = True

[network]
port = 5000
host = 0.0.0.0
diff --git a/web/docker-compose.yml b/web/docker-compose.yml
index c3b0e74..f00a3a2 100644
--- a/web/docker-compose.yml
+++ b/web/docker-compose.yml
@@ -3,11 +3,8 @@ version: "3.6"
services:
  simplytranslate:
    build: .
    container_name: "simplytranslate"
    networks:
      - egress
    container_name: simplytranslate
    ports:
      - "5000:5000"
networks:
  egress:
    external: true
      - "127.0.0.1:5000:5000"
    volumes:
      - "./config.conf:/etc/simplytranslate/web.conf"
diff --git a/web/uvicorn/Dockerfile b/web/uvicorn/Dockerfile
index d502178..fb1959f 100644
--- a/web/uvicorn/Dockerfile
+++ b/web/uvicorn/Dockerfile
@@ -1,6 +1,6 @@
FROM python:3-slim

RUN apt update && apt upgrade && apt install -y git
RUN apt update && apt upgrade && apt install -y git automake libtool g++-multilib zlib1g-dev  build-essential gcc g++ libxml2 libxml2-dev libxslt1.1 libxslt1-dev

RUN git clone https://git.sr.ht/~metalune/simplytranslate_engines engines && \
    git clone https://git.sr.ht/~metalune/simplytranslate_web web
-- 
2.33.0
We got an e-mail from somebody saying they're having some trouble with
`web/Dockerfile`:
> I am trying to build SimplyTranslate on arm64v8 using Docker, and the
> logs complain that g++-multilib-i686-linux-gnu does not exist.
I'm not a Docker expert by any means, but in `web/uvicorn/Dockerfile`,
`g++-multilib` is depended on instead of `g++-multilib-i686-linux-gnu`;
is there any reason not to use that in `web/Dockerfile` too?