Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker #390

Open
essaddam opened this issue Aug 30, 2023 · 0 comments
Open

Docker #390

essaddam opened this issue Aug 30, 2023 · 0 comments

Comments

@essaddam
Copy link

Hello ,
i have try deploy in docker with :
version: '3'
services:
web-service:
build:
context: /PERSONNA
dockerfile: Dockerfileold
environment:

expose:
build:
context: /expose
dockerfile: Dockerfile-20
environment:
- EXPOSE_URL_TO_SHARE=web-service
- EXPOSE_PORT_TO_SHARE=8001
- EXPOSE_SERVER_KEY=eu-1
- EXPOSE_SERVER_TOKEN=mmmmmm
- EXPOSE_PUBLIC_DOMAIN=mmmm
- EXPOSE_PUBLIC_SUBDOMAIN=mm
restart: always
ports:
- "4040:4040"
depends_on:
- web-service

with
FROM php:8.1-cli
RUN apt-get update
RUN apt-get install -y git libzip-dev zip

RUN docker-php-ext-install zip

Téléchargez l'archive Expose

RUN curl https://github.com/beyondcode/expose/raw/master/builds/expose -L --output expose.phar

Rendez l'archive exécutable

Déplacez l'archive dans un répertoire accessible globalement

RUN mv expose.phar /usr/local/bin/expose
RUN chmod 755 /usr/local/bin/expose

Exposez le port par défaut d'Expose (4040)

EXPOSE 4040

#CMD ["sh", "-c", "expose default-server ${EXPOSE_SERVER_KEY}"]

Définissez la commande par défaut pour exécuter Expose

CMD ["sh", "-c", "expose share ${EXPOSE_URL_TO_SHARE}:${EXPOSE_PORT_TO_SHARE} --auth=${EXPOSE_SERVER_TOKEN} --subdomain=${EXPOSE_PUBLIC_SUBDOMAIN} --domain=${EXPOSE_PUBLIC_DOMAIN} --server=${EXPOSE_SERVER_KEY} -vvv"]

the vm expose can curl http://web-service:8001 but all request with public url are time out .

if i use :
FROM debian:buster

Mettez à jour les paquets et installez les dépendances nécessaires

RUN apt-get update &&
apt-get install -y wget build-essential libssl-dev zlib1g-dev libbz2-dev
libreadline-dev libsqlite3-dev curl libffi-dev libncurses5-dev libncursesw5-dev
xz-utils tk-dev liblzma-dev python-openssl git

RUN apt-get install -y supervisor
RUN mkdir -p /etc/supervisor/conf.d
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

Installez les bibliothèques OpenSSL supplémentaires

RUN apt-get install -y libssl-dev openssl

Installez Python 3.9

RUN wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz &&
tar xvf Python-3.9.0.tgz &&
cd Python-3.9.0 &&
./configure --enable-optimizations &&
make altinstall &&
cd .. &&
rm -rf Python-3.9.0.tgz Python-3.9.0

Installez PHP 8.1 et les extensions nécessaires

RUN apt-get install -y lsb-release apt-transport-https ca-certificates &&
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg &&
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list &&
apt-get update &&
apt-get install -y php8.1 php8.1-cli php8.1-common php8.1-curl php8.1-mbstring php8.1-mysql php8.1-xml

Définissez le répertoire de travail dans le conteneur

WORKDIR /app

Installez les dépendances nécessaires pour construire SQLite

RUN apt-get install -y wget build-essential libreadline-dev zlib1g-dev unzip
RUN apt-get install tcl-dev tk-dev libffi-dev libssl-dev -y
RUN apt-get install libssl-dev -y

Téléchargez et installez SQLite à partir du fichier zip

RUN wget https://www.sqlite.org/2023/sqlite-src-3420000.zip &&
unzip sqlite-src-3420000.zip &&
cd sqlite-src-3420000 &&
./configure --enable-fts5 &&
make &&
make install &&
cd .. &&
rm -rf sqlite-src-3420000 sqlite-src-3420000.zip

Configurez l'environnement pour utiliser la version installée de SQLite

ENV LD_LIBRARY_PATH /usr/local/lib

Copiez le fichier requirements.txt dans le conteneur

COPY requirements.txt .
RUN pip3.9 install --upgrade pip

Installez les dépendances Python

RUN pip3.9 install --no-cache-dir -r requirements.txt

Téléchargez l'archive Expose

RUN curl https://github.com/beyondcode/expose/raw/master/builds/expose -L --output expose.phar

Rendez l'archive exécutable et déplacez-la dans un répertoire accessible globalement

RUN chmod 755 expose.phar &&
mv expose.phar /usr/local/bin/expose

Copiez tous les fichiers Python du répertoire actuel dans le conteneur

COPY *.py ./
run expose token 222222222222

Démarrez le serveur FastAPI

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]

and

[supervisord]
nodaemon=true

[program:expose]
command=expose share http://localhost:8001 --subdomain=test --domain=toto.local
numprocs=1
autostart=true
autorestart=false
user=root

[program:uvicorn]
command=uvicorn serve:app --host 0.0.0.0 --port 8001 --reload
numprocs=1
autostart=true
autorestart=true
user=root

it's working .

thank you for your help .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant