-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(.copier-config.yaml): create new template config file
- Loading branch information
1 parent
6ede94e
commit 55d1569
Showing
61 changed files
with
4,308 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Changes here will be overwritten by Copier; do NOT edit manually | ||
_commit: v0.12.1-1-ged875bd | ||
_src_path: gh:entelecheia/hyperfast-python-template | ||
author: Young Joon Lee | ||
build_and_release: false | ||
code_template_answers_file: .copier-hyfi-config.yaml | ||
code_template_source: '' | ||
codecov_graph_token: '[REPLACE_ME]' | ||
copyright_year: 2024 | ||
documentaion_tool: jupyter-book | ||
documentation_url: https://entelecheia.github.io/course-template | ||
email: entelecheia@hotmail.com | ||
favicon_path: https://assets.entelecheia.ai/favicon.png | ||
friendly_name: Course Template | ||
github_repo_name: course-template | ||
github_username: entelecheia | ||
google_analytics_id: '' | ||
logo_path: '' | ||
main_branch: main | ||
package_name: coursetemp | ||
package_scripts: | ||
- coursetemp = 'coursetemp.__cli__:main' | ||
poe_task_files: | ||
- .tasks.toml | ||
- .tasks-extra.toml | ||
project_description: A template for a course | ||
project_license: CC-BY-4.0 | ||
project_name: course-template | ||
project_short_description: A template for a course | ||
upload_to_release: false | ||
upload_to_repository: false | ||
use_launch_buttons: true | ||
use_source_code_skeleton: false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Changes here will be overwritten by Copier; do NOT edit manually | ||
_commit: v0.28.4 | ||
_src_path: gh:entelecheia/hyperfast-docker-template | ||
app_dirname: course_temp | ||
app_install_root: /workspace/projects | ||
app_service_name: app | ||
app_source_branch: main | ||
app_source_repo: entelecheia/course-template | ||
author: Young Joon Lee | ||
build_images_from_dockerfile: true | ||
clone_source_code: true | ||
container_workspace_root: /workspace | ||
copy_scripts_dir: true | ||
cuda_device_id: '6' | ||
docker_app_image_variant_name: app | ||
docker_apt_packages: fontconfig fonts-nanum | ||
docker_base_build_from: nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 | ||
docker_base_image_variant_name: base | ||
docker_container_uid: 9001 | ||
docker_container_username: dev | ||
docker_image_version_variable_name: APP_VERSION | ||
docker_name_prefix: COURSE_TEMP | ||
docker_project_name: course-template | ||
docker_registry: ghcr.io | ||
docker_run_command: zsh | ||
docker_service_name: workspace | ||
docker_timezone: Asia/Seoul | ||
docker_username: entelecheia | ||
email: entelecheia@hotmail.com | ||
enable_nvidia_gpu: true | ||
friendly_name: Course Template | ||
github_repo_name: course-template | ||
github_username: entelecheia | ||
install_dotfiles: true | ||
install_pip_requirements: false | ||
jupyter_host_port: 19871 | ||
jupyter_port: 8585 | ||
jupyter_token: '' | ||
launch_scripts: launch.sh | ||
main_branch: main | ||
pip_command: pip3 | ||
project_description: A template for a course | ||
project_license: MIT | ||
project_short_description: A template for a course | ||
python_command: python3.10 | ||
ssh_host_port: 2341 | ||
ssh_port: 22 | ||
use_builder_image_and_copy_venv: false | ||
use_deploy_workflows: true | ||
use_jupyter: true | ||
use_semantic_versioning_for_image: true | ||
use_ssh_service: true | ||
use_web_service: true | ||
web_service_host_port: 18761 | ||
web_service_port: 8080 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.copierignore | ||
.tasks-extra.toml | ||
CHANGELOG.md | ||
pyproject.toml | ||
Makefile | ||
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
#!/bin/bash | ||
# add your custom commands here that should be executed when building the docker image | ||
# arguments usage | ||
USAGE=" | ||
$0 COMMAND [OPTIONS] | ||
Arguments: | ||
COMMAND The operation to be performed. Must be one of: [build|config|push|login|up|down|run] | ||
Options: | ||
-v, --variant IMAGE_VARIANT Specify a variant for the Docker image. | ||
-p, --pid PROJECT_ID Specify a project ID for the container instance. | ||
-r, --run RUN_COMMAND Specify a command to run when using the 'run' command. Default: bash | ||
-h, --help Display this help message. | ||
Additional arguments can be provided after the Docker name, and they will be passed directly to the Docker Compose command. | ||
Example: | ||
$0 build -v base | ||
" | ||
|
||
# declare arguments | ||
PROJECT_ID="default" | ||
COMMAND="build" | ||
VARIANT="base" | ||
RUN_COMMAND="bash" | ||
ADDITIONAL_ARGS="" | ||
|
||
set +u | ||
# read arguments | ||
# first argument is the command | ||
COMMAND="$1" | ||
shift | ||
|
||
# parse options | ||
while [[ $# -gt 0 ]]; do | ||
case "$1" in | ||
-v | --variant) | ||
VARIANT="$2" | ||
shift | ||
;; | ||
--variant=*) | ||
VARIANT="${1#*=}" | ||
;; | ||
-p | --pid) | ||
PROJECT_ID="$2" | ||
shift | ||
;; | ||
--pid=*) | ||
PROJECT_ID="${1#*=}" | ||
;; | ||
-r | --run) | ||
RUN_COMMAND="$2" | ||
shift | ||
;; | ||
--run=*) | ||
RUN_COMMAND="${1#*=}" | ||
;; | ||
-h | --help) | ||
echo "Usage: $0 $USAGE" >&2 | ||
exit 0 | ||
;; | ||
-h*) | ||
echo "Usage: $0 $USAGE" >&2 | ||
exit 0 | ||
;; | ||
*) | ||
ADDITIONAL_ARGS="$ADDITIONAL_ARGS $1" | ||
;; | ||
esac | ||
shift | ||
done | ||
# check if remaining arguments exist | ||
if [[ -n "$ADDITIONAL_ARGS" ]]; then | ||
echo "Additional arguments: $ADDITIONAL_ARGS" >&2 | ||
fi | ||
set -u | ||
|
||
if [ "${COMMAND}" == "build" ]; then | ||
echo "Building docker image for variant: ${VARIANT}" | ||
elif [ "${COMMAND}" == "config" ]; then | ||
echo "Printing docker config for variant: ${VARIANT}" | ||
elif [ "${COMMAND}" == "push" ]; then | ||
echo "Pushing docker image for variant: ${VARIANT}" | ||
elif [ "${COMMAND}" == "up" ]; then | ||
echo "Starting docker container for variant: ${VARIANT}" | ||
elif [ "${COMMAND}" == "down" ]; then | ||
echo "Stopping docker container for variant: ${VARIANT}" | ||
elif [ "${COMMAND}" == "run" ]; then | ||
echo "Running docker container for variant: ${VARIANT}" | ||
elif [ "${COMMAND}" == "login" ]; then | ||
echo "Logging into docker registry for variant: ${VARIANT}" | ||
else | ||
echo "Invalid command: $COMMAND" >&2 | ||
echo "Usage: $0 $USAGE" >&2 | ||
exit 1 | ||
fi | ||
echo "---" | ||
|
||
# load environment variables and print them | ||
set -a | ||
# load secert environment variables from .env.secret | ||
DOCKER_SECRET_ENV_FILENAME=${DOCKER_SECRET_ENV_FILENAME:-".env.secret"} | ||
if [ -e "${DOCKER_SECRET_ENV_FILENAME}" ]; then | ||
echo "Loading secret environment variables from ${DOCKER_SECRET_ENV_FILENAME}" | ||
set -x # print commands and thier arguments | ||
# shellcheck disable=SC1091,SC1090 | ||
source "${DOCKER_SECRET_ENV_FILENAME}" | ||
set +x # disable printing of environment variables | ||
fi | ||
# load global environment variables from .env.docker | ||
DOCKERFILES_SHARE_DIR=${DOCKERFILES_SHARE_DIR:-"$HOME/.local/share/dockerfiles"} | ||
DOCKER_GLOBAL_ENV_FILENAME=${DOCKER_GLOBAL_ENV_FILENAME:-".env.docker"} | ||
DOCKER_GLOBAL_ENV_FILE=${DOCKER_GLOBAL_ENV_FILE:-"${DOCKERFILES_SHARE_DIR}/${DOCKER_GLOBAL_ENV_FILENAME}"} | ||
if [ ! -e "${DOCKER_GLOBAL_ENV_FILENAME}" ] && [ -e "${DOCKER_GLOBAL_ENV_FILE}" ]; then | ||
echo "Symlinking ${DOCKER_GLOBAL_ENV_FILE} to ${DOCKER_GLOBAL_ENV_FILENAME}" | ||
ln -s "${DOCKER_GLOBAL_ENV_FILE}" "${DOCKER_GLOBAL_ENV_FILENAME}" | ||
fi | ||
if [ -e "${DOCKER_GLOBAL_ENV_FILENAME}" ]; then | ||
echo "Loading global environment variables from ${DOCKER_GLOBAL_ENV_FILENAME}" | ||
set -x # print commands and thier arguments | ||
# shellcheck disable=SC1091,SC1090 | ||
source "${DOCKER_GLOBAL_ENV_FILENAME}" | ||
set +x # disable printing of environment variables | ||
fi | ||
# shellcheck disable=SC1091 | ||
source .docker/docker.version | ||
PROJECT_ID_ENV_FILE=".docker/.ids/${PROJECT_ID}.env" | ||
if [ -e "${PROJECT_ID_ENV_FILE}" ]; then | ||
echo "Loading project ID specific environment variables from ${PROJECT_ID_ENV_FILE}" | ||
set -x # print commands and thier arguments | ||
# shellcheck disable=SC1091,SC1090 | ||
source "${PROJECT_ID_ENV_FILE}" | ||
set +x # disable printing of environment variables | ||
fi | ||
if [ -e .docker/docker.common.env ]; then | ||
echo "Loading common environment variables from .docker/docker.common.env" | ||
set -x # print commands and thier arguments | ||
# shellcheck disable=SC1091 | ||
source .docker/docker.common.env | ||
set +x # disable printing of environment variables | ||
fi | ||
if [ -e ".docker/docker.${VARIANT}.env" ]; then | ||
echo "Loading environment variables from .docker/docker.${VARIANT}.env" | ||
set -x # print commands and thier arguments | ||
# shellcheck disable=SC1091,SC1090 | ||
source ".docker/docker.${VARIANT}.env" | ||
set +x # disable printing of environment variables | ||
fi | ||
set +a | ||
|
||
# prepare docker network | ||
if [[ -n "${CONTAINER_NETWORK_NAME}" ]] && ! docker network ls | grep -q "${CONTAINER_NETWORK_NAME}"; then | ||
echo "Creating network ${CONTAINER_NETWORK_NAME}" | ||
docker network create "${CONTAINER_NETWORK_NAME}" | ||
else | ||
echo "Network ${CONTAINER_NETWORK_NAME} already exists." | ||
fi | ||
|
||
# prepare local workspace to be mounted | ||
echo "Preparing local workspace directories" | ||
[ ! -d "${HOST_WORKSPACE_ROOT}" ] && mkdir -p "${HOST_WORKSPACE_ROOT}" | ||
[ ! -d "${HOST_SCRIPTS_DIR}" ] && cp -r "$PWD/.docker/scripts" "${HOST_SCRIPTS_DIR}" | ||
[ ! -d "${HOST_SSH_DIR}" ] && mkdir -p "${HOST_SSH_DIR}" | ||
[ ! -d "${HOST_CACHE_DIR}" ] && mkdir -p "${HOST_CACHE_DIR}" | ||
[ ! -d "${HOST_HF_HOME}" ] && mkdir -p "${HOST_HF_HOME}" | ||
[ ! -d "${HOST_GH_CONFIG_DIR}" ] && mkdir -p "${HOST_GH_CONFIG_DIR}" | ||
[ ! -d "${HOST_PASSAGE_DIR}" ] && mkdir -p "${HOST_PASSAGE_DIR}" | ||
|
||
# run docker-compose | ||
if [ "${COMMAND}" == "push" ]; then | ||
CMD="docker push ${CONTAINER_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}" | ||
elif [ "${COMMAND}" == "login" ]; then | ||
echo "GITHUB_CR_PAT: $GITHUB_CR_PAT" | ||
CMD="docker login ghcr.io -u $GITHUB_USERNAME" | ||
elif [ "${COMMAND}" == "run" ]; then | ||
CMD="docker compose --project-directory . -f .docker/docker-compose.${VARIANT}.yaml run workspace ${RUN_COMMAND} ${ADDITIONAL_ARGS}" | ||
else | ||
CMD="docker-compose --project-directory . -f .docker/docker-compose.${VARIANT}.yaml -p ${CONTAINER_HOSTNAME} ${COMMAND} ${ADDITIONAL_ARGS}" | ||
fi | ||
echo "Running command: ${CMD}" | ||
eval "${CMD}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.virtual_documents | ||
jupyterhub* | ||
.vscode | ||
.history | ||
workspace | ||
data | ||
refs | ||
tmp | ||
logs | ||
outputs | ||
.env* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
PROJECT_ID="admin" | ||
CONTAINER_CUDA_DEVICE_ID=0 | ||
HOST_WORKSPACE_LOCATION="$PWD/workspace/$PROJECT_ID" | ||
HOST_WORKSPACE_ROOT="$HOME/workspace" | ||
HOST_SCRIPTS_DIR="$PWD/.docker/scripts" | ||
HOST_SSH_DIR="$HOME/.ssh" | ||
HOST_CACHE_DIR="$HOST_WORKSPACE_LOCATION/.cache" | ||
HOST_HF_HOME="$HOST_CACHE_DIR/huggingface" | ||
HOST_SSH_PORT=12201 | ||
HOST_JUPYTER_PORT=18801 | ||
HOST_WEB_SVC_PORT=18081 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
DOCKER_PROJECT_ID="app" | ||
|
||
HOST_WORKSPACE_LOCATION=${WORKSPACE_LOCATION:-"$PWD/workspace/$PROJECT_ID"} | ||
HOST_WORKSPACE_ROOT=${WORKSPACE_ROOT:-"$HOST_WORKSPACE_LOCATION/workspace"} | ||
HOST_SCRIPTS_DIR="$PWD/.docker/scripts" | ||
HOST_SSH_DIR="$HOST_WORKSPACE_LOCATION/.ssh" | ||
HOST_CACHE_DIR="$HOST_WORKSPACE_LOCATION/.cache" | ||
HOST_HF_HOME=${HF_HOME:-"${HOST_WORKSPACE_LOCATION}/.cache/huggingface"} | ||
HOST_GH_CONFIG_DIR="$HOST_WORKSPACE_LOCATION/.config/gh" | ||
HOST_PASSAGE_DIR="$HOST_WORKSPACE_LOCATION/.passage" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
DOCKER_PROJECT_ID="default" | ||
|
||
HOST_WORKSPACE_LOCATION=${WORKSPACE_LOCATION:-"$PWD/workspace/$PROJECT_ID"} | ||
HOST_WORKSPACE_ROOT=${WORKSPACE_ROOT:-"$HOST_WORKSPACE_LOCATION/workspace"} | ||
HOST_SCRIPTS_DIR="$PWD/.docker/scripts" | ||
HOST_SSH_DIR="$HOME/.ssh" | ||
HOST_CACHE_DIR="$HOME/.cache" | ||
HOST_HF_HOME=${HF_HOME:-"${HOME}/.cache/huggingface"} | ||
HOST_GH_CONFIG_DIR="$HOME/.config/gh" | ||
HOST_PASSAGE_DIR="$HOME/.passage" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
PROJECT_ID="id" | ||
CONTAINER_CUDA_DEVICE_ID=0 | ||
HOST_WORKSPACE_LOCATION="$PWD/workspace/$PROJECT_ID" | ||
HOST_WORKSPACE_ROOT="$HOST_WORKSPACE_LOCATION/workspace" | ||
HOST_SCRIPTS_DIR="$HOST_WORKSPACE_ROOT/scripts" | ||
HOST_SSH_DIR="$HOST_WORKSPACE_LOCATION/.ssh" | ||
HOST_CACHE_DIR="$HOST_WORKSPACE_LOCATION/.cache" | ||
HOST_HF_HOME="$HOST_CACHE_DIR/huggingface" | ||
HOST_SSH_PORT=12212 | ||
HOST_JUPYTER_PORT=18812 | ||
HOST_WEB_SVC_PORT=18012 |
Oops, something went wrong.