Closed sammcj closed 1 year ago
I made standalone one here https://github.com/LajaSoft/audio-webui-docker
Awesome thank you, I'll take a look after work today or tomorrow and submit a PR if I have any ideas :)
I'll link this project in the readme so people can find it quicker
I'll link this project in the readme so people can find it quicker
May be you advice me then which other directories better to make persistent, may be you place some configs or files somewhere, i made it just wanted to run it :) so may be it miss something like this.
@zba / @gitmylo I spent a bit of time coming up with a PR last night to improve it with multi-stage build etc.... but I kept hitting issues when this "magicinstaller" was installing the dependencies so I think I need to re-think it a bit.
--
Just if you're interested in what I was trying to do:
Usually you'd have two or more "stages" (container images),
The first - a build stage - where you can install all-the-things to build your software such as cmake, build-essential, git, wget etc... - but most of these things you wouldn't want in the shipped code (image containing code) because they introduce both a lot of security risk but also greatly increase the size of the artifact.
The second - the run stage - you build from a much lighter (or indeed an almost empty base aka scratch) and copy in your application code and anything that's required to run it (but not build it) from the build stage. This way you end up with a nice light artifact with no or minimal compiling / building capability which greatly reduces the attack surface.
So I got to something like this:
### Build image ###
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 as build
# Install dependencies
RUN apt-get update && apt-get install --no-install-recommends -y python3 python3-venv libx11-dev \
git python3-pip python3-dev build-essential cmake && rm -rf /var/lib/apt/lists/ /var/cache/apt/
# Create a non-root user with home directory /app
RUN git clone https://github.com/gitmylo/audio-webui /app/audio-webui --depth=1
COPY ./.env /app
WORKDIR /app/audio-webui
# Activate virtual environment and install dependencies
RUN . /app/.env \
&& python3 -m venv venv \
&& . venv/bin/activate \
&& pip install --upgrade numpy==1.23.5 praat-parselmouth \
&& python3.10 install.py
### Runtime image ###
FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04 as runtime
# Install runtime dependencies
RUN apt-get update && apt-get install --no-install-recommends -y python3 python3-venv ffmpeg \
python3-pip && rm -rf /var/lib/apt/lists/ /var/cache/apt/
COPY --from=build /app /app
# Create a non-root user and fix permissions
RUN useradd --home-dir /app appuser \
&& chown -R appuser:appuser /app \
&& chmod +x /app/audio-webui/*.sh
WORKDIR /app/audio-webui
# Switch down to the non-root user
USER appuser
RUN . /app/.env \
&& python3.10 -m venv venv \
&& . venv/bin/activate
EXPOSE 7860
ENTRYPOINT ["python3.10", "main.py", "--listen"]
But found that the main application - runs this magic installer thing that then goes and needs to clone and compile a bunch of things.
Anyway, if I get some more time this weekend I'll try getting it to work, otherwise I am very grateful for your image @zba :)
I think you overcomplicated it as me when I tried to do it first, the problem, i think multistage not needed there, entrypoint is better as command: in docker-compose.yml , the main problem, that depends handled not in requirements.txt so you need to run installer, and i not sure, but it seems install.py do it slightly different, than run.sh, so I just create venv, place correct numpy version and run in run stage, not in build, for build i just download repo (using installer). If you still want multistage, i suggest to copy only venv part from building stage, also docker has some problems with mounting during build stage, so you can just check what in my repo and decide own way :) also it good to keep model dirs on local directory, not inside docker, just because else way each build you will need to load models back. Also you can decide volume .:/app so you can just run it on "local" source and not copy to image anything :)
Hi,
You can also see here: https://github.com/gitmylo/audio-webui/pull/104
I think it's best to keep docker separate from the main repo, not as a part of it. As I do not have experience with docker, and will not be managing it.
The same thing is happening with stable diffusion. Perhaps you could add something in the README to inforrm where to find the dockerized versions (mine and sammcj's) I renamed my fork https://github.com/jacen92/audio-webui-docker for the occasion
Is your feature request related to a problem? Please describe.
It would be great if this could be shipped as a docker project.
Describe the solution you'd like
Even if the images weren't pre-built it would be nice to be able to do a docker-compose up and have it running.
Describe alternatives you've considered
🤷
Additional context Add any other context or screenshots about the feature request here.