This repository contains the necessary files to build and run a Docker container for the civitai-models-cli. The service is configured using a Dockerfile
and docker-compose.yaml
.
You can checkout the project here: https://github.com/civitai/civitai-models-cli
Important
You must first copy or reanme the docker.env
file to .env
and make sure to update
the MODEL_DIR
variable to the location where you models are stored on yoour host before running any of the docker commands.
Note
It is recommend that you update the sample.env
file before running the docker commands. You do not need to rename this file to .env
, it will be automatically renamed when copied into the container.
- Docker
- Docker Compose
The Dockerfile
is used to create a Docker image for the civitai-models-cli. It is based on the debian:bullseye-slim
image and installs the necessary dependencies, including Python 3 and various Python packages.
- Base Image: Uses
debian:bullseye-slim
as the base image. - System Updates and Cleanup: Updates the package list and removes unnecessary packages.
- Python Installation: Installs Python 3 and pip.
- Environment Variables: Sets environment variables for locale and PATH.
- Python Packages: Installs required Python packages using pip.
- Working Directory: Sets the working directory to
/home/civitaiuser
. - Copy Files: Copies the
.env
file andrequirements.txt
to the container. - Install Python Dependencies: Installs Python dependencies from
requirements.txt
. - User Setup: Creates a new user
civitaiuser
and switches to this user. - Default Command: Sets the default command to
bash
.
The docker-compose.yaml
file is used to define and run the civitai-models-cli as a Docker container.
- version: Specifies the version of Docker Compose.
- services: Defines the services to be run.
- civitai-service: The main service.
- build: Specifies the build context.
- container_name: Names the container
civitai-container
. - environment: Sets environment variables.
- volumes: Mounts the current directory to
/home/civitaiuser
in the container. - working_dir: Sets the working directory to
/home/civitaiuser
. - command: Sets the default command to
bash
.
- civitai-service: The main service.
-
Clone the Repository:
git clone <repository-url> cd <repository-directory>
-
Build and Run the Docker Container:
docker-compose up --build
-
Using run.sh (Linux/macOS):
./run.sh
-
Using run.bat (Windows):
run.bat
-
Access the Container: The container will start and you can access it using:
docker exec -it civitai-container zsh
To stop the service, run:
docker-compose down
- Environment Variables: Ensure that the
.env
file contains the necessary environment variables for the service. - Python Dependencies: List all required Python packages in
requirements.txt
.