From 8d85f8b33c2fa51bef6c82aedb0e20b74f3c5453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Wed, 10 Nov 2021 00:20:00 +0100 Subject: [PATCH] feat(docker): now working properly --- Dockerfile | 41 +++++++++++++++------------------------ docker-compose.yml | 6 ++---- memo.full.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++ memo.sh | 17 ++++++++++++++++ src/client.html | 2 +- src/emulator.py | 1 - src/server.py | 4 +--- 7 files changed, 84 insertions(+), 35 deletions(-) create mode 100644 memo.full.sh create mode 100644 memo.sh diff --git a/Dockerfile b/Dockerfile index c19ff37..af009d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python:alpine AS base -# set /code as the workdirectory +# set /code as the work directory WORKDIR /code RUN \ @@ -14,7 +14,7 @@ RUN \ && pip install poetry cffi # copy poetry config files -COPY ./pyproject.toml /code/ +COPY ./pyproject.toml /code RUN \ cd /code \ @@ -28,43 +28,32 @@ RUN \ && cmake -DBUILD_PYTHON=ON -DBUILD_QT=OFF -DBUILD_SDL=OFF -DUSE_DISCORD_RPC=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr/local .. \ # build mGBA && make \ - && make install \ - && cd /code/mgba/src/platform/python/ \ - && BINDIR=/code/mgba/build/include/ LIBDIR=/code/mgba/build/include/ python setup.py install \ - && cd /code/ \ - && poetry install - - + # install mGBA + && make install +RUN \ + cd /code/mgba/src/platform/python \ + # install mGBA bindings + && BINDIR=/code/mgba/build/include LIBDIR=/code/mgba/build/include python setup.py install RUN \ # go to the workdir cd /code/ \ - # config poetry to not create a .venv + # # config poetry to not create a .venv && poetry config virtualenvs.create false \ - # upgrade pip + # # upgrade pip && poetry run pip install --upgrade pip \ # install poetry - && BINDIR=/code/mgba/build/ LIBDIR=/code/mgba/build/ poetry install --no-interaction --no-ansi --no-dev - -# stuck at poetry install ! -# elfutils-dev for libelf -# libzip-tools || libzip-dev for libzip -# minizip-dev for minizip -# libedit-dev for libedit -# sqlite-dev for sqlite3 -# libepoxy-dev for expoxy -# ffmpeg-dev for libavcodec -# libpng-dev for png -# technique d'enlever le -b et de faire setup.py install fonctionne + && poetry install --no-interaction --no-ansi --no-dev # copy the src files -COPY ./src /code/ +COPY ./src /code/src COPY ./roms/pokemon.gba /code/roms/pokemon.gba + # create server image FROM base as server -CMD [ "poetry","run","python", "/code/server.py" ] +CMD [ "poetry", "run", "python", "/code/src/server.py" ] # create emulator image FROM base as emulator -CMD [ "poetry","run","python", "/code/emulator.py" ] +CMD [ "poetry", "run", "python", "/code/src/emulator.py" ] diff --git a/docker-compose.yml b/docker-compose.yml index d540435..06cf4b4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: server: build: context: . - target: server + entrypoint: poetry run python src/server.py ports: - 6789:6789 depends_on: @@ -11,7 +11,7 @@ services: emulator: build: context: . - target: emulator + entrypoint: poetry run python src/emulator.py depends_on: - "rtmp" - "redis" @@ -23,5 +23,3 @@ services: image: "tiangolo/nginx-rtmp" ports: - 1935:1935 - -# build mgba dans le conteuneur car broken path sinon diff --git a/memo.full.sh b/memo.full.sh new file mode 100644 index 0000000..eba225d --- /dev/null +++ b/memo.full.sh @@ -0,0 +1,48 @@ +0 apk update +1 apk add build-base cmake git +2 apk add libffi-dev elfutils-dev libzip-tools minizip-dev libedit-dev sqlite-dev libepoxy-dev ffmpeg-dev libpng-dev +3 pip install poetry cffi +4 mkdir /code +5 cd /code +6 git clone https://github.com/mgba-emu/mgba.git mgba +7 mkdir mgba/build +8 cd mgba/build +9 cmake -DBUILD_PYTHON=ON -DBUILD_QT=OFF -DBUILD_SDL=OFF -DUSE_DISCORD_RPC=OFF .. +10 make +11 apk add vim +12 vim +13 vim pyproject.tom +14 vim pyproject.toml +15 cd /code +16 poetry config virtualenvs.create false +17 poetry run pip install --upgrade pip +18 vim pyproject.toml +19 poetry run pip install --upgrade pip +20 BINDIR=/code/mgba/build/ LIBDIR=/code/mgba/build/ poetry install --no-interaction --no-ansi --no-dev +21 which python +22 ls /usr/local +23 cmake -DBUILD_PYTHON=ON -DBUILD_QT=OFF -DBUILD_SDL=OFF -DUSE_DISCORD_RPC=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr/local +24 cmake -DBUILD_PYTHON=ON -DBUILD_QT=OFF -DBUILD_SDL=OFF -DUSE_DISCORD_RPC=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr/local .. +25 cmake -DBUILD_PYTHON=ON -DBUILD_QT=OFF -DBUILD_SDL=OFF -DUSE_DISCORD_RPC=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/ .. +26 cd mgba/build +27 cmake -DBUILD_PYTHON=ON -DBUILD_QT=OFF -DBUILD_SDL=OFF -DUSE_DISCORD_RPC=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/ .. +28 make +29 cd /code/ +30 BINDIR=/code/mgba/build/ LIBDIR=/code/mgba/build/ poetry install +31 poetry install +32 cd mgba/src/platform/python/ +33 python setup.py install +34 BINDIR=/code/mgba/build/ LIBDIR=/code/mgba/build/ python setup.py install +35 BINDIR=/code/mgba/build/ LIBDIR=/code/mgba/build/ python setup.py installfind +36 find +37 find / | grep flags.h +38 BINDIR=/code/mgba/build/include/ LIBDIR=/code/mgba/build/include/ python setup.py installfind +39 BINDIR=/code/mgba/build/include/ LIBDIR=/code/mgba/build/include/ python setup.py install +40 cd ../../.. +41 cd build +42 make install +43 mgba +44 cd .. +45 cd src/platform/python/ +46 BINDIR=/code/mgba/build/include/ LIBDIR=/code/mgba/build/include/ python setup.py install +47 history diff --git a/memo.sh b/memo.sh new file mode 100644 index 0000000..880fed5 --- /dev/null +++ b/memo.sh @@ -0,0 +1,17 @@ +apk update +apk add build-base cmake git vim +apk add libffi-dev elfutils-dev libzip-tools minizip-dev libedit-dev sqlite-dev libepoxy-dev ffmpeg-dev libpng-dev jpeg-dev +pip install poetry cffi +mkdir /code +cd /code +vim pyproject.toml # copy le pyproject.tom manuel +git clone https://github.com/mgba-emu/mgba.git mgba +mkdir mgba/build +cd mgba/build +cmake -DBUILD_PYTHON=ON -DBUILD_QT=OFF -DBUILD_SDL=OFF -DUSE_DISCORD_RPC=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/ .. +make +make install +cd /code/mgba/src/platform/python/ +BINDIR=/code/mgba/build/include/ LIBDIR=/code/mgba/build/include/ python setup.py install +cd /code/ +poetry install diff --git a/src/client.html b/src/client.html index 3e06cf5..3c1e7e8 100644 --- a/src/client.html +++ b/src/client.html @@ -79,7 +79,7 @@