update Dockerfile

- link environment.yml from new environemnts path
- change default conda_env_file
- quote all variables to avoid splitting
- also remove paths from conda-env-files in build-container.yml
This commit is contained in:
mauwii 2022-11-10 04:14:35 +01:00
parent 44a18511fa
commit a5719aabf8
No known key found for this signature in database
GPG Key ID: D923DB04ADB3F5AB
2 changed files with 25 additions and 16 deletions

View File

@ -17,9 +17,9 @@ jobs:
- aarch64 - aarch64
include: include:
- arch: x86_64 - arch: x86_64
conda-env-file: environments-and-requirements/environment-lin-cuda.yml conda-env-file: environment-lin-cuda.yml
- arch: aarch64 - arch: aarch64
conda-env-file: environments-and-requirements/environment-lin-aarch64.yml conda-env-file: environment-lin-aarch64.yml
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: ${{ matrix.arch }} name: ${{ matrix.arch }}
steps: steps:

View File

@ -43,33 +43,42 @@ RUN apt-get update \
ARG invokeai_git=invoke-ai/InvokeAI ARG invokeai_git=invoke-ai/InvokeAI
ARG invokeai_branch=main ARG invokeai_branch=main
ARG project_name=invokeai ARG project_name=invokeai
RUN git clone -b ${invokeai_branch} https://github.com/${invokeai_git}.git /${project_name} \ ARG conda_env_file=environment-lin-cuda.yml
&& cp /${project_name}/configs/models.yaml.example /${project_name}/configs/models.yaml \ RUN git clone -b ${invokeai_branch} https://github.com/${invokeai_git}.git "/${project_name}" \
&& ln -s /data/models/v1-5-pruned-emaonly.ckpt /${project_name}/models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt \ && cp \
&& ln -s /data/outputs/ /${project_name}/outputs "/${project_name}/configs/models.yaml.example" \
"/${project_name}/configs/models.yaml" \
&& ln -sf \
"/${project_name}/environments-and-requirements/${conda_env_file}" \
"/${project_name}/environment.yml" \
&& ln -sf \
/data/models/v1-5-pruned-emaonly.ckpt \
"/${project_name}/models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt" \
&& ln -sf \
/data/outputs/ \
"/${project_name}/outputs"
# set workdir # set workdir
WORKDIR /${project_name} WORKDIR "/${project_name}"
# install conda env and preload models # install conda env and preload models
ARG conda_prefix=/opt/conda ARG conda_prefix=/opt/conda
ARG conda_env_file=environment.yml COPY --from=get_miniconda "${conda_prefix}" "${conda_prefix}"
COPY --from=get_miniconda ${conda_prefix} ${conda_prefix} RUN source "${conda_prefix}/etc/profile.d/conda.sh" \
RUN source ${conda_prefix}/etc/profile.d/conda.sh \
&& conda init bash \ && conda init bash \
&& source ~/.bashrc \ && source ~/.bashrc \
&& conda env create \ && conda env create \
--name ${project_name} \ --name "${project_name}" \
--file ${conda_env_file} \
&& rm -Rf ~/.cache \ && rm -Rf ~/.cache \
&& conda clean -afy \ && conda clean -afy \
&& echo "conda activate ${project_name}" >> ~/.bashrc \ && echo "conda activate ${project_name}" >> ~/.bashrc
&& conda activate ${project_name} \
RUN source ~/.bashrc \
&& python scripts/preload_models.py \ && python scripts/preload_models.py \
--no-interactive --no-interactive
# Copy entrypoint and set env # Copy entrypoint and set env
ENV CONDA_PREFIX=${conda_prefix} ENV CONDA_PREFIX="${conda_prefix}"
ENV PROJECT_NAME=${project_name} ENV PROJECT_NAME="${project_name}"
COPY docker-build/entrypoint.sh / COPY docker-build/entrypoint.sh /
ENTRYPOINT [ "/entrypoint.sh" ] ENTRYPOINT [ "/entrypoint.sh" ]