-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 48192cf
Showing
5 changed files
with
176 additions
and
0 deletions.
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,56 @@ | ||
name: docker-publish | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'lynx-container-tag' | ||
required: false | ||
default: '' | ||
env: | ||
REGISTRY: ghcr.io | ||
ARM_RID: linux-arm64 | ||
AMD_RID: linux-x64 | ||
|
||
jobs: | ||
publish-docker-images: | ||
name: Publish Docker images | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
docker-target: [lichess-bot-playground] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set LICHESS-BOT-PLAYGROUND-VERSION env var | ||
if: env.LICHESS-BOT-PLAYGROUND-VERSION == '' | ||
shell: pwsh | ||
run: | | ||
echo "LICHESS-BOT-PLAYGROUND-VERSION=$("${{ github.event.inputs.tag }}".Replace('v', ''))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | ||
- name: Docker login | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
target: ${{ matrix.docker-target }} | ||
platforms: | | ||
linux/amd64 | ||
linux/arm64 | ||
tags: | | ||
${{ env.REGISTRY }}/lynx-chess/lichess-bot-playground:${{ env.LICHESS-BOT-PLAYGROUND-VERSION }} | ||
push: true | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
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,59 @@ | ||
name: Create release | ||
on: | ||
registry_package: | ||
types: [published, updated] | ||
workflow_dispatch: | ||
inputs: | ||
new_container_version: | ||
description: 'lichess-bot container release version' | ||
required: true | ||
default: '' | ||
env: | ||
LICHESS_BOT_PLAYGROUND_RELEASE_TAG: ${{ github.event.registry_package.package_version.container_metadata.tag.name }} | ||
|
||
jobs: | ||
create-release-bundle: | ||
name: Create release bundle | ||
if: github.event.inputs.new_container_version != '' || (github.event.registry_package.name == 'lichess-bot-playground' && github.event.registry_package.package_version.container_metadata.tag.name != 'latest' && github.event.registry_package.package_version.container_metadata.manifest.media_type == 'application/vnd.docker.distribution.manifest.list.v2+json') | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set LICHESS_BOT_PLAYGROUND_RELEASE_TAG env var | ||
if: env.LICHESS_BOT_PLAYGROUND_RELEASE_TAG == '' | ||
shell: pwsh | ||
run: | | ||
echo "LICHESS_BOT_PLAYGROUND_RELEASE_TAG=${{ github.event.inputs.new_container_version }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | ||
- name: Upload lichess-bot-playground v${{ env.LICHESS_BOT_PLAYGROUND_RELEASE_TAG }} artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: lichess-bot-playground-${{ env.LICHESS_BOT_PLAYGROUND_RELEASE_TAG }} | ||
path: | | ||
Dockerfile | ||
README.md | ||
LICENSE | ||
if-no-files-found: error | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: lichess-bot-playground-${{ env.LICHESS_BOT_PLAYGROUND_RELEASE_TAG }} | ||
path: artifacts/ | ||
|
||
- name: Compress artifact files | ||
run: zip -0 -r -q -j "artifacts/lichess-bot-playground-${{ env.LICHESS_BOT_PLAYGROUND_RELEASE_TAG }}.zip" "artifacts/" | ||
|
||
- name: Create GitHub release and upload assets | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
set -x | ||
assets=() | ||
for asset in artifacts/*.zip; do | ||
assets+=("-a" "$asset") | ||
done | ||
tag_name="v${{ env.LICHESS_BOT_PLAYGROUND_RELEASE_TAG }}" | ||
hub release create "${assets[@]}" --draft --message "$tag_name" --message "[lichess-bot-playground $tag_name](https://github.com/lynx-chess/lichess-bot-playground/releases/tag/$tag_name)" "$tag_name" |
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,28 @@ | ||
FROM python:3.9.17 as base | ||
|
||
############################################################ | ||
# Distro setup | ||
############################################################ | ||
|
||
WORKDIR /home/src/ | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y git nano && \ | ||
apt-get install -y git python3-pip python3-virtualenv python3-venv | ||
|
||
FROM base as lichess-bot-playground | ||
|
||
############################################################ | ||
# Repo setup | ||
############################################################ | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
RUN git clone https://github.com/lichess-bot-devs/lichess-bot | ||
WORKDIR /home/src/lichess-bot | ||
|
||
RUN python3 -m venv venv | ||
RUN virtualenv venv -p python3 | ||
RUN source ./venv/bin/activate | ||
RUN python3 -m pip install -r requirements.txt | ||
|
||
RUN mv config.yml.default config.yml |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Eduardo Cáceres | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,12 @@ | ||
# lichess-bot-container | ||
|
||
Dockerfile for [ghcr.io/lynx-chess/lichess-bot-playground](ghcr.io/lynx-chess/lichess-bot-playground) | ||
|
||
## RUN | ||
|
||
```bash | ||
docker run --name lichess-bot-playground -it \ | ||
--mount type=bind,src=$PWD/engines,dst=/home/src/lichess-bot/engines \ | ||
-w /home/src/lichess-bot \ | ||
ghcr.io/lynx-chess/lichess-bot-playground bash | ||
``` |