diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f967ee004..4ade667a4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -97,29 +97,29 @@ upload-windows-updater-release: - aws --endpoint-url $AWS_SERVICE_URL s3api put-object --bucket "$AWS_BUCKET_NAME" --key "dl/bot/$INSTALLER_FILE_NAME" --acl public-read --body "$INSTALLER_OUTPUT_DIR/$INSTALLER_FILE_NAME" - aws --endpoint-url $AWS_SERVICE_URL s3api put-object --bucket "$AWS_BUCKET_NAME" --key "dl/bot/releases-v3.json" --acl public-read --body "releases-v3.json" -# docker-build: -# # Use the official docker image. -# image: docker:latest -# stage: build -# services: -# - docker:dind -# before_script: -# - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY -# # Default branch leaves tag empty (= latest tag) -# # All other branches are tagged with the escaped branch name (commit ref slug) -# script: -# - | -# if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then -# tag="" -# echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" -# else -# tag=":$CI_COMMIT_REF_SLUG" -# echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" -# fi -# - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . -# - docker push "$CI_REGISTRY_IMAGE${tag}" -# # Run this job in a branch where a Dockerfile exists -# rules: -# - if: $CI_COMMIT_BRANCH -# exists: -# - Dockerfile +docker-build: + # Use the official docker image. + image: docker:latest + stage: build + services: + - docker:dind + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + # Default branch leaves tag empty (= latest tag) + # All other branches are tagged with the escaped branch name (commit ref slug) + script: + - | + if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then + tag="" + echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" + else + tag=":$CI_COMMIT_REF_SLUG" + echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" + fi + - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . + - docker push "$CI_REGISTRY_IMAGE${tag}" + # Run this job in a branch where a Dockerfile exists + rules: + - if: $CI_COMMIT_BRANCH + exists: + - Dockerfile diff --git a/docs/guides/docker-guide.md b/docs/guides/docker-guide.md index 780dd3bf2..b7a328f69 100644 --- a/docs/guides/docker-guide.md +++ b/docs/guides/docker-guide.md @@ -1,18 +1,25 @@ # Setting up NadekoBot with Docker -# DO NOT USE YET - WORK IN PROGRESS +# WORK IN PROGRESS -### Docker Compose +### Installation + +1. Create a `/srv/nadeko` folder + - `mkdir -p /srv/nadeko` +2. Create a `docker-compose.yml` + - nano `docker-compose.yml` + - copy the following contents into it: +##### docker-compose.yml ```yml version: "3.7" services: nadeko: - image: registry.gitlab.com/veovis/nadekobot:v3-docker + image: registry.gitlab.com/kwoth/nadekobot:latest depends_on: - redis environment: TZ: Europe/Paris - #NadekoBot_RedisOptions: redis,name=nadeko + NadekoBot_RedisOptions: redis,name=nadeko #NadekoBot_ShardRunCommand: dotnet #NadekoBot_ShardRunArguments: /app/NadekoBot.dll {0} {1} volumes: @@ -27,6 +34,12 @@ services: volumes: - /srv/nadeko/redis-data:/data ``` +3. Save your file and run docker compose + - `docker-compose up` +4. Edit creds in `/srv/nadeko/conf/creds.yml` +5. Run it again with + - `docker-compose up` + ### Updating - `cd /srv/nadeko` - `docker-compose pull`